0

Iam working with a phonegap app, i have used InAppBrowser in my project but when i clicked the link, xcode console shows the below error:

"Failed to load webpage with error: The requested URL was not found on this server."

and my code will look like:

<a href=”#” onclick='window.open(‘www.google.com',’_blank‘,’location=yes‘,’closebuttoncaption=Return‘);'>Click Here</a>

iam using xcode 4.5 and phonegap 2.7.0. I really got stuck, please help.

Mumthezir VP
  • 6,251
  • 6
  • 28
  • 57
  • 1
    Are you mixing the usage of quotes? If I read your code correctly, you are either closing the quote for `onclick` at the beginning of `url` or you are sending in the literal string of `url,`. Please verify. I would advice you to use `onclick="..."` and then you can use single quotes within it `''` to reduce confusion and necessity of escaping. – Jamie Starke Jul 03 '13 at 06:02
  • thanks!! now it works, it has problem on quotes which is copied from browser along the code.. – Mumthezir VP Jul 03 '13 at 08:39
  • Did you change your question code to the correct working code? – Jamie Starke Jul 03 '13 at 13:29

2 Answers2

1

I believe that the correct form of this should be

<a href=”#” onclick="window.open('http://www.google.com', '_blank', 'location=yes');">Click Here</a>

This is based on the documented version from the PhoneGap 2.7.0 Documentation.

It appears that the closebuttoncaption=Return parameter you have added is not actually in the specification.

Jamie Starke
  • 8,776
  • 3
  • 38
  • 58
0
var myURL = encodeURI('http://www.google.com');
window.open(myURL, '_blank', 'location=yes'); 

You can refer below link :-

Phonegap App : External URL don't open in InApp Browser of IOS

Community
  • 1
  • 1
Shashi
  • 1,165
  • 5
  • 20
  • 39