I'm trying to put in an iframe in Polymer Designer (https://polymer-designer.appspot.com/) but it won't display any webpage with "http" and other websites like "google" and "youtube" I don't know if there is any way I can fix this but if any of you have an idea how to fix it I'm all ears.
1 Answers
To insert an <iframe>
into an element from within the Polymer Designer:
- Open the Polymer Designer with http (http://polymer-designer.appspot.com/) (to load the
<iframe>
in step 3). - Click <> at the top left to go into Code View.
Inside the
<template>
tag, add your<iframe>
. It should look like this:<polymer-element name="my-element"> ... <template> <iframe src="http://www.w3schools.com/"></iframe> </template> </polymer-element>
Notes:
The Polymer Designer has not been updated in a while, and it's using an obsolete Polymer version with elements that are no longer relevant. I recommend following the Polymer docs to get started with the newest version of Polymer (1.4.0).
If you open your browser console while in Polymer Designer, you'll see error messages when you try to use an
<iframe>
togoogle.com
oryoutube.com
:Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
Refused to display 'https://www.youtube.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
This error indicates that the servers disallow loading of the resource in an
<iframe>
outside of their domain (see this answer for more details).The browser console log will also show you the error regarding http:
Mixed Content: The page at 'https://polymer-designer.appspot.com/' was loaded over HTTPS, but requested an insecure resource 'http://www.w3schools.com/'. This request has been blocked; the content must be served over HTTPS.
To resolve this, you can change the
<iframe>
URL to use https (if that server allows) to match the current protocol, or simply access the Designer from http (http://polymer-designer.appspot.com/).