iframe is not working ,show an error,why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 19

iframe is not working ,show an error,why?

Refused to display 'https://www.google.com/ in a frame because it set X-Frame-Options' to 'sameorigin. Line: 1 is showing on console window ,what is this?

22nd Jun 2018, 1:35 PM
Kelvin Paul
Kelvin Paul - avatar
11 Answers
+ 3
Here are some of Google's response headers (from the webserver) when I initially connect: Date: Sun, 24 Jun 2018 04:59:52 GMT X-Frame-Options: SAMEORIGIN Content-Type: text/html; charset=UTF-8 X-Final-Url: https://www.google.com/ Expires: Sun, 24 Jun 2018 04:59:52 GMT The header causing the problem is: "X-Frame-Options: SAMEORIGIN". https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options From the article, Google may be trying to ensure their content "is not embedded into other sites", which is (among other reasons) a protection against clickjacking. https://en.m.wikipedia.org/wiki/Clickjacking
24th Jun 2018, 5:26 AM
Kirk Schafer
Kirk Schafer - avatar
+ 9
it works for me: Check out this: https://code.sololearn.com/WtV7rvY8TJyl/?ref=app
8th Jun 2020, 12:37 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
+ 7
😥any solutions?
22nd Jun 2018, 1:38 PM
Kelvin Paul
Kelvin Paul - avatar
+ 7
hyperlink to the iframe source as an alternative but keep your iframe in place until server is up standard <a href
22nd Jun 2018, 1:48 PM
BroFar
BroFar - avatar
+ 5
so what is the meta tag for the web page , please explain 😊
24th Jun 2018, 10:50 AM
Kelvin Paul
Kelvin Paul - avatar
+ 4
normally if the server refuses iframe displays, you can't access it
22nd Jun 2018, 1:37 PM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar
+ 3
well, you need to ask yourself why would i need a iframe that shows google’s frontpage. Because of that, google blocks it because now you could pretent your google if you put the iframe on fullscreen. But, there is a way around it! use a proxy and it will work ;) It’s not the best way to do it though xD
23rd Jun 2018, 12:19 PM
Ezzar
23rd Jun 2018, 10:10 PM
BroFar
BroFar - avatar
+ 2
iframe is not further supported in HTML5.
23rd Jun 2018, 2:28 PM
Muhammad Owais
Muhammad Owais - avatar
+ 1
it is still valid if you use iframe in html5, though some things are not supported anymore in html5. to make it even better, they added somethings to the iframe to make it more secure like “sandbox” and they added a useful option called “seamless”. If you would like an alternative you could use “object” wich is a html attribute. Its not made to do stuff like external content, but it works though xD
23rd Jun 2018, 7:02 PM
Ezzar
+ 1
Kirk Schafer which is actually odd because for years they and their development team have shown and even given instructions in how to embed their products into websites...
24th Jun 2018, 1:33 PM
BroFar
BroFar - avatar