Created
February 15, 2012 18:22
-
-
Save heymatthenry/1837975 to your computer and use it in GitHub Desktop.
Minimum test case for an iframe with a remote src pointing at an ad tag. The behavior we'd like to see is for links inside the iframe to open in the Android browser. Currently they just open inside the iframe (as you might expect). Changing the target att
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <title>PhoneGap</title> | |
| <script type="text/javascript" charset="utf-8" src="phonegap-1.4.1.js"></script> | |
| </head> | |
| <body> | |
| <iframe src="http://mwhenry.com/ad.html" /> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Okay, this was an interesting problem. Thanks for sending it to me as I now feel like I have an even better idea of what goes on under the hood. While one would think you could modify DroidGap.shouldOverrideUrlLoading() to get the behaviour you desire but that is not the case as it is not called for iframes. If you want to cause the Android browser to open you'll need to override a method in your Java class that extends DroidGap. Something like this:
You'll have to decide a mechanism of when to redirect to the external browser. Hope that helps.