Iframe not loading for IOS

  • 2
  • Problem
  • Updated 4 years ago
  • Solved
In the IOS app I built using phonegap, I have an Iframe load external site. This works fine in android . In IOS the Iframe does not load the external site. Is there a workaround for this?
Photo of SB

SB

  • 24 Posts
  • 0 Reply Likes

Posted 5 years ago

  • 2
Photo of SB

SB

  • 24 Posts
  • 0 Reply Likes
I got the latest plugin for whitelist. In my config.xml file I have

<plugin name="cordova-plugin-whitelist"/>
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-navigation href="*" />
<allow-intent href="*" />

I also added the metatag in my index.html file

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
You don't have the plugin, because that line contains two errors:
- you used a PLUGIN element, which is unknown to PGB
- you failed to set the source attribute to 'npm'
Photo of SB

SB

  • 24 Posts
  • 0 Reply Likes
Thanks Petra, I added

<gap:plugin name="cordova-plugin-whitelist" source="npm"/>

and still the iframe does not load external site.

What am I missing?
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Not sure.
I would first remove that CSP meta tag and retry, to find out if that causes the problem.
Photo of Amir

Amir

  • 8261 Posts
  • 263 Reply Likes
Here is a complete guide on hot to add plugins to a project:
http://docs.build.phonegap.com/en_US/configuring_plugins.md.html#Plugins
Photo of SB

SB

  • 24 Posts
  • 0 Reply Likes
Amir, Thanks for replying. As suggested in the document i added the plugin in my
config.xml as

<gap:plugin name="cordova-plugin-whitelist" source="npm"/>


and in my index.html i have the meta tag



<meta http-equiv="Content-Security-Policy" content="default-src 'self'; frame-src 'self' https://msn.com">


This still did not load the external site to the iframe in IOS.
Photo of M.Erkan Çam

M.Erkan Çam

  • 13 Posts
  • 2 Reply Likes
Hey! How did you solve this problem ? I have the same issue right now