Iframe - https site not working my app. Please help

Iframe - https site not working my app. Please help

Hello Try embedding a youtube video. I tried and it working.

Kindly share code. This is iframe https url : https://www.genworth.com/life-and-annuity-transition-sales-center.html itn’t working

Hello I tried the above URL and its not rendering the page within i-frame because, Same-Origin policy has been set for the site and you cannot embed that site within in an iframe. Even you cannot embed https://www.google.com within the iframe because of same-origin policy. For more information checkout this link:

http://javascript.info/tutorial/same-origin-security-policy

On my console I got this error this is because of same origin policy:
Refused to display ‘https://www.genworth.com/life-and-annuity-transition-sales-center.html’ in a frame because it set ‘X-Frame-Options’ to 'SAMEORIGIN

Having used iframe personally but this might help https://cordova.apache.org/docs/en/latest/guide/appdev/whitelist/ ?

You really should not be using iframes at all in you app.
If you need to load content from a website, use the inappbrowser plugin.

Thanks for your suggestion, kindly share inappbrwser plugin url or sample code…

Inappbrowser used to open a external browser in our app. but how to open with in a page?

InAppBrowser is ugly though… it loses app’s UI (header, footer nav, etc) - typically not a great solution.

Agreed, thats why I’ve been suggesting

As a better alternative

hmm… interesting. screenshots don’t show app UI though; so how is this better than InAppBrowser?

The point isn’t to show “app UI”, it for external content that you want to show, but not open in external safari.

If you want to actually load a site and embed it in your app, you’re not going to have a good time I’m afraid. Apps like this can be rejected by apple as they’re not what they want an app to be. Instead, setup a simple REST API and load JSON data.

1 Like