Javascript 将youtube、stackoverflow或facebook主页加载到iframe标记时出错
当我尝试使用以下代码将facebook或youtube加载到iframe标记时,什么都没有发生。页面未加载到iframe标记中 多个网站如youtube、stackoverflow和facebook都会出现此问题Javascript 将youtube、stackoverflow或facebook主页加载到iframe标记时出错,javascript,html,Javascript,Html,当我尝试使用以下代码将facebook或youtube加载到iframe标记时,什么都没有发生。页面未加载到iframe标记中 多个网站如youtube、stackoverflow和facebook都会出现此问题 <head> <title>HTML Test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
<head>
<title>HTML Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Below is an iframe.</p>
<iframe src="http://www.youtube.com/" width="400" height="150">
<p>iframes are not supported by your browser.</p>
</iframe>
</body>
</html>
代码:
<head>
<title>HTML Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Below is an iframe.</p>
<iframe src="http://www.youtube.com/" width="400" height="150">
<p>iframes are not supported by your browser.</p>
</iframe>
</body>
</html>
HTML测试
下面是一个iframe
<head>
<title>HTML Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Below is an iframe.</p>
<iframe src="http://www.youtube.com/" width="400" height="150">
<p>iframes are not supported by your browser.</p>
</iframe>
</body>
</html>
您的浏览器不支持iFrame
<head>
<title>HTML Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Below is an iframe.</p>
<iframe src="http://www.youtube.com/" width="400" height="150">
<p>iframes are not supported by your browser.</p>
</iframe>
</body>
</html>
请提供任何帮助您提到的站点可能会禁用iFrame的访问
<head>
<title>HTML Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Below is an iframe.</p>
<iframe src="http://www.youtube.com/" width="400" height="150">
<p>iframes are not supported by your browser.</p>
</iframe>
</body>
</html>
在这个例子中,我的网站运行得很好:我试过了
<head>
<title>HTML Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Below is an iframe.</p>
<iframe src="http://www.youtube.com/" width="400" height="150">
<p>iframes are not supported by your browser.</p>
</iframe>
</body>
</html>
<head>
<title>HTML Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Below is an iframe.</p>
<iframe src="http://www.youtube.com/" width="400" height="150">
<p>iframes are not supported by your browser.</p>
</iframe>
</body>
</html>
看着控制台,我明白了
<head>
<title>HTML Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Below is an iframe.</p>
<iframe src="http://www.youtube.com/" width="400" height="150">
<p>iframes are not supported by your browser.</p>
</iframe>
</body>
</html>
X-Frame-Options禁止显示
<head>
<title>HTML Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Below is an iframe.</p>
<iframe src="http://www.youtube.com/" width="400" height="150">
<p>iframes are not supported by your browser.</p>
</iframe>
</body>
</html>
所以我认为那些网站不允许框架,这可能有一个解决办法,但我要说的是,你应该尊重他们,而不是框架他们我知道很多其他网站工作得很好,但我的问题是这3个sites@naruto你显然没有完全阅读我的答案。这些站点必须启用某种脚本或标题,以阻止iFrame访问其站点。首先,我感谢您的帮助,但您的意思是,这个问题没有解决方案。这正是我要说的:没有解决方案,因为您提到的每个站点都阻止了这种行为。
<head>
<title>HTML Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Below is an iframe.</p>
<iframe src="http://www.youtube.com/" width="400" height="150">
<p>iframes are not supported by your browser.</p>
</iframe>
</body>
</html>