inappbrowser execute inside external iframe

  • 2
  • Question
  • Updated 5 years ago
  • Doesn't Need an Answer
hi,

is the following possible?

lets say I have a phonegap app, and in the html I have an iframe, loading a page from a webserver. now, i want to use inappbrowser for website links within the iframe, so that it will load the link in an external "system" browser.

can client side phonegap work if api is called from webserver?
Photo of Jeremy A

Jeremy A

  • 9 Posts
  • 0 Reply Likes

Posted 5 years ago

  • 2
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
You could:
- use the inAppBrowser plugin in your app's config.xml
- define a function that takes an url and calls window.open(url,"_system") in the HEAD of the parent document (which is the html document that has the iframe in its body)
- call that function from the hyperlink in the document within the iframe:
<a href="javascript:parent.openThis('http://www.yoururl.com');return false;">...</a>


Of course, that's only feasible if you are in control of yoururl.com's source code.
Photo of Niraj Dhakal

Niraj Dhakal

  • 3 Posts
  • 0 Reply Likes
can you please give an example of step no. 2 ? i.e: defining a function that takes an url and calls window.open(url,"_system") in the HEAD of the parent document (which is the html document that has the iframe in its body)
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
Examples for using the InAppBrowser are available in the documentation of the plugin. As is the case for all plugins.