Search code examples
cordovaiframeionic2tabview

How to load a URL with iFrame in Ionic 2


I wanted to load an URL with Iframe in ionic project. Please have a look at the below sample. https://stackblitz.com/edit/ionic-tab-samples

I have written my code in home.ts file.

How can I embedded an URL inside a tabVIew.

Thanks in Advance.


Solution

  • You're trying to display github.com, which gives the following error :

    Refused to display 'https://github.com/' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'".
    

    This error is displaying due to GitHub's Content Security Policy of not allowing it's view to be displayed within an iframe

    If you try with something else, like https://www.openstreetmap.org/export/embed.html, your code works well. Dependings on which sites you want to display, you should use the In App Browser ionic native plugin.