从网上找了一段自动刷新网页的html代码运行报错:Refused to display 'https://render.alipay.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
麻烦各位看看
代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<iframe src="https://render.alipay.com/p/f/fd-j1xcs5me/comment-share.html?commentId=2021004104617700DG061c42dffce04444a060a6d54184c370" width="800" height="600"></iframe>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script type="text/javascript">
setInterval(function () {
console.log("刷屏");
$('iframe').attr('src', $('iframe').attr('src'));
}, 35000)
</script>
</body>
</html>
代码本身没问题,但是现在的浏览器不支持框架集了,你可以用 ie 老式浏览器看到效果
第三方链接控制了,不让链接内容不能被嵌入到任何iframe或frame中
报错Refused to display 'https://render.alipay.com/'in a frame because it set 'X-Frame-Options'to 'sameorigin'.
其实就是链接被禁止禁止引用了,试试别的网站链接都是可以的
这是由于打开了服务器配置文件里的X-Frame-Options配置模块
如果服务器是自己的,只需要进入apache文件里的httpd.conf配置文件里,把 这一行注释掉即可正常加载
你把报错 Refused to display 'https://render.alipay.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin' 复制到百度一下答案一大堆。
服务器不准跨域,你这个网站别人做了限制