0

I am opening a link which is not part of my domain, let's say Using this piece of code <a href="http://www.google.com" id="google"> <img src="images/google.png" ></a>'

Now when the user clicks this, my app redirects to google. I am trying to use the hardware back button on android to go back to my application.

When i press the back button, i get this message on logcat: 10-20 19:54:21.375: E/Web Console(29676): Uncaught ReferenceError: cordova is not defined at :1

What i have been able to understand from this is that when the link is redirected to google, our app has lost control of the phonegap. Is it so? I have tried using data-rel="external" with this link. But it doesn't makes any difference...

Following this, I have two problems i need help with

  • When user presses hardware back button, go back to my app.
  • When the google.com page is loading, user sees the page loading widget.
Jazib
  • 1,200
  • 1
  • 16
  • 39

1 Answers1

0

Take a look at the Phonegap ChildBrowser plugin, it could help you with your problem, here an excerpt:

The child browser allows you to display external web pages within your PhoneGap application.

A simple use case would be:

  • Users can post links, and you don't want your users to exit your app to view the link.

This command creates a popup browser that is shown in front of your app, when the user presses the back button they are simply returned to your app.

Nelson
  • 49,283
  • 8
  • 68
  • 81
  • Thankyou for the reference. I have set up the plugin, but apparently it is not working as it should. Have you used it in any of your app? – Jazib Oct 20 '12 at 23:41
  • No sorry I haven't, but I've seen many references from happy users of this plugin, try posting your error so we can help you. – Nelson Oct 21 '12 at 04:58
  • I don't get any error, the childbrowser simply won't load. Can you please refer any working example which uses childbrowser in it? – Jazib Oct 21 '12 at 22:37