rel="noopener"与Web安全演示页面
展示
请点击下面的链接:
代码
-
HTML:
请点击下面的链接: <p> <a href="./target.html" target="_blank" rel="opener">目标页面</a> </p>
-
target.html页面的JS:
const opener = window.opener; if (opener) { opener.location.hash = '#hack'; opener.document.body.insertAdjacentHTML('beforeend', '<span style="position:absolute;outline:solid red;font-size:100px;left:calc(50% - 2.5em);top:208px;">哈哈哈,💩</span>'); }