Loading external website into iframe

Hello,

I am trying to load an external page into an Iframe but i just get a white page. Read somewhere that it might be related to the content-security-policy. If so, how do I go about allowing the load of external page into iframe?

I am using framework 7 2.0

Here is the code:

Thank you for yor time.

I don’t see any code, but a white page is expected if the target site has CSP headers. If you own the site you can set the frame-src policy. Otherwise, you will have to use something like an in app browser. See this thread: Load a facebook page within Page container?

1 Like

Thank you for the info. I followed the link but opted to go with a class=“external” solution.

The issue i was trying to avoid is that when a user follows an external link, and the goes back to the APP, the APP automatically refreshs and goes back to the home page. Is there any way to aviod this? When going back to the APP i would like it to remain on the same page.

Thank you in advance.

Are you developing for iOS? Apps can be forced to sleep if they are not focused for a certain time range. Check your Xcode settings to allow background execution, so when you return to the app it is not having to re-launch itself.

https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

There are also Cordova plugins that help with this:

1 Like

Actualy I am using framework 7 to develop a progressive web APP. Is there a method that works in these cases?

Thank you.

Did you wrap your iframe in a .page-content element?