aisowe

减轻被恶意网站修改父窗口 URL 的风险

方法1:给 a 标签添加 rel 属性

<a href="https://an.evil.site" target="_blank" rel="noopener">恶意网站</a>

方法2:打开子窗口时将子窗口的 opener 设置为 null

const newWin = window.open(\'example.html\');
newWin.opener = null;

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-06-20
  • 2021-09-01
  • 2021-06-29
  • 2021-11-22
  • 2022-12-23
  • 2021-06-12
  • 2021-11-21
猜你喜欢
  • 2021-04-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
  • 2022-02-03
  • 2021-12-05
相关资源
相似解决方案