Problem with Iframe opening in Mobile Safari instead of in existing window.

  • 1
  • Question
  • Updated 9 years ago
  • Answered
I think I have the same problem as I had when I was using PhoneGap with IOS SDK.
When I use iFrame the infromationtion doesnt open in the window. Instead Mobile safari is started and the information is open in that instead.
In order to fix it I had to create a new install package with the latest update and install that.
How do you handle the update in Phonegap build. Do I have to wait for a new relase of Phonegap and until that is instlled in Phonegap Build?
Photo of per.liljeqvist

per.liljeqvist

  • 21 Posts
  • 0 Reply Likes

Posted 9 years ago

  • 1
Photo of Hardeep Shoker

Hardeep Shoker

  • 1941 Posts
  • 89 Reply Likes
Hello,

Actually to begin, I highly discourage the use of iframes in your mobile application for many reasons. Firstly, the PhoneGap api is not available in the Iframe unless you inject it through the parent or load the PhoneGap api in the actual iframe. Secondly, Iframes may be prone to rendering issues, and may give you a performance hit. The alternative to Iframes that most developers use is to request external content into the current document via XHR requests, an example in your case would be to have an empty DIV container, perform a XHR and replace the contents of the DIV with the returned content.

Here is some documentation on performing XHR requests using JQuery
http://api.jquery.com/jQuery.ajax/
Photo of per.liljeqvist

per.liljeqvist

  • 21 Posts
  • 0 Reply Likes
Thanks.

I understand it is better using XHR. But for what I am doing in this appication it is simplier just to use iframe and insert the content of a HTML page. Its just used for displaying information,

So my question is still. Its possible to use it when you use IOS SDK and PhoneGap. with earlier releases but not with the present 0.9.5. But its working with the update of 0.9.5. So My question is will you update the PhoneGap you are using on PhoneGap Build. And when will you do it.

I think its working ok for the Android.
Photo of Hardeep Shoker

Hardeep Shoker

  • 1941 Posts
  • 89 Reply Likes
Just for a little bit more information on the subject, is the Iframe loading a local file or external file?

Hardeep Shoker
Photo of per.liljeqvist

per.liljeqvist

  • 21 Posts
  • 0 Reply Likes
The application I am developing is mostly based on local information. But we use iFrame to include information from an external webserver. Its information about events and the information will change often. The idea is to be able to incorporate this information seemlesly into the application.
When we build use IOS SDK we have to update the PhoneGap.plist with the following information:

ExternalHosts

www.RiksText.se
10.0.0.2

The host shown here is both a public host and a computer used as a server on the local network we are using together with the app.
Photo of Hardeep Shoker

Hardeep Shoker

  • 1941 Posts
  • 89 Reply Likes
Hello,

So after some testing I able to confirm that currently loading external resources via iframe will open a safari browser, so my suggestion for getting it working right now is via XHR. PhoneGap build should be using the latest version on PhoneGap Build.

(Local files are loaded within the Iframe)

Hardeep Shoker