我尝试使用iframe加载具体的网页:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<iframe id="frame" src="http://www.euronics.ee/" frameBorder="0" width="1000px" height="700px"></iframe>
</body>
</html>
为什么它无法加载整页。它只加载身体?如果我尝试,它会很好地加载另一页。
答案 0 :(得分:5)
如果您检查网站代码,您会看到:
<script type="text/javascript">
//This block of javascript checks if the current page is opened in a popup IFrame
//and if this is true - closes popup and reloads parent window.
//We use Popup template for popup windows and only this template is accepted for popups. A window with any other template will be closed immidiately.
//This also solves the problem with redirecting to parent after user has logged in via Login popup. After loggin in user is redirected back to My Account page
//which in turn uses Audio template thus immidiately gets closed and parent gets reloaded.
if (self != top) {
$("body").empty(); //also clears body to avoid showing page content while the page is closing
parent.location.reload();
}
</script>
这就是为什么我不会在你的iframe中加载网站的原因。 不是每个人都喜欢他们的网站在iframe的其他网站上展示的想法。我想说他们只是想要真正的访客。
答案 1 :(得分:0)
当我在jsfiddle中尝试时,我收到以下控制台错误: 阻止具有原点“http://www.euronics.ee”的框架访问具有原点“http://fiddle.jshell.net”的框架。协议,域和端口必须匹配。 可能是您加载的网站有https请求吗?