为什么有些网站在iframe中使用时会自动重定向到它

时间:2014-10-13 16:59:36

标签: html redirect iframe

我有这个页面:

<html>
<head>
<title>my title</title>
</head>
<body>
<iframe src="http://www.shereno.com"></iframe>
</body>
</html>

但在1秒后重定向到http://www.shereno.com

后执行此页面

你可以在iframe whitout重定向中使用这个网址吗?

1 个答案:

答案 0 :(得分:0)

在HTML5中使用sandbox属性禁用allow-top-navigation,允许文档通过导航顶级窗口突破框架。我们定义sandbox属性并将allow-top-navigation退出!

<html>
<head>
<title>my title</title>
</head>
<body>
<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms" src="http://www.shereno.com"></iframe>
</body>
</html>