How to Use iframe to embed external web pages in Ionic?


I am tying embed external webpage in iframe, But this is not working. anyone can help me on this. I am using Ionic 5. I am writing this code in I was just create anew application with tabs template.

<div id="container">
  <strong>{{ name }}</strong>
  <iframe class='webPage' src="" style="width:100%; height:100%;"></iframe>

after execution in App this error isshowing. “Web Page is not available”.

Kindly help me on this.

Kind Regards,

You also need to be aware of the X-Frame-Options header. If the site you are trying to load in an iframe has it set to SAMEORIGIN you are out of luck. It looks like does have it set to SAMEORIGIN.

1 Like

I don’t know if this is still the case, but I recall @mhartington frequently exhorting people not to use iframes at all, instead recommending InAppBrowser.