Iframes not working

拜拜、爱过 提交于 2019-12-07 00:55:32

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/7947144/iframes-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!