VM1776 afterlogin.htm:4 Uncaught DOMException: Failed to set the ‘href’ property on ‘Location’: The current window does not have permission to navigate the target frame to
之所以报这个错的原因是因为你嵌套在iframe中的网页,居然试图干掉现在链接,重新开一个窗口,为了防止xss攻击,iframe表示我不同意坚决不同意
iframe默认情况下:
在html5页面中,可以使用iframe的sandbox属性,
sandbox包含的主要属性及作用:
allow-scripts 运行执行脚本
allow-same-origin 允许同域请求,比如ajax,storage
allow-top-navigation 允许iframe能够主导window.top进行页面跳转
allow-popups 允许iframe中弹出新窗口,比如,window.open,target=”_blank”
allow-pointer-lock在iframe中可以锁定鼠标,主要和鼠标锁定有关
在iframe加上这个代码之后sandbox=”allow-scripts allow-top-navigation allow-same-origin”只能解决嵌套页面在本页面本窗口跳转页面的情况,不能解决在frame中新开窗口的问题,