New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[html] 第49天 说说你对target="_blank"的理解?有啥安全性问题?如何防范? #185
Comments
在新的空白页, 打开该链接, |
防范:
|
我在Chrome和IE中测试,发现 document.referer 都为空字符啊, 难道我理解错了? |
w3c介绍: 如果当前文档不是通过超级链接访问的,则为 null。这个属性允许客户端 JavaScript 访问 HTTP 引用头部。 |
问题在调用window下的open方法创建一个新窗口的同时,可以获得一个创建窗口的opener句柄,通过target="_blank"点开的窗口活着标签页,子窗口也能捕获opener句柄,通过这个句柄,子窗口可以访问到父窗口的一些属性,虽然很有限,但是却可以修改父窗口的页面地址,让父窗口显示指定的页面。 防范如果需要限制window.opener的访问行为,我们只需要在原始页面每个使用了target="_blank"的链接中加上一个rel="noopener"属性。
nofollow 是HTML页面中a标签的属性值。这个标签的意义是告诉搜索引擎"不要追踪此网页上的链接或不要追踪此特定链接"。 |
恶意攻击 步骤如下:
预防
|
请问这个a标签的地址是自己写上去的吗?为啥不写个安全的链接? |
第49天 说说你对target="_blank"的理解?有啥安全性问题?如何防范?
The text was updated successfully, but these errors were encountered: