Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iframes not working

Tags:

html

iframe

frame

I'm trying to get Iframes to work. I'm running safari, so it is compatible, but when I test it, it comes up blank. Code:

<iframe src="http://www.google.com" width="100%" height="300">

<p>Your browser does not support iframes.</p>

</iframe>

I took the code directly from the w3schools website after using the "try it out" editor so I know it's supposed to work. When I changed the page from a page in their subdirectory to an external page, it shows up blank.

like image 417
Chris Avatar asked Oct 30 '11 19:10

Chris


2 Answers

The syntax is correct. It's not your fault - Google is blocking iframing using the X-Frame-Options header that newer browsers listen to.

Possible workarounds are explained in this Google forum post.

like image 172
Pekka Avatar answered Oct 13 '22 14:10

Pekka


Follow the instruction in the following Google Developer Site under "IFrame embeds using the IFrame Player API" bullet: https://developers.google.com/youtube/player_parameters

This uses API's JavaScript code to view youtube videos.

Here's the link with a more general instruction https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player

like image 35
Antonio Jha Avatar answered Oct 13 '22 13:10

Antonio Jha