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