问题
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