Js使用window.open(url)打开外链报错:The HTTP request is not acceptable for the requested resource.

noopener=yes,noreferrer=yes
点击跳转外链地址时,由于浏览器安全策略会在请求头中添加referrer以显示来源地址,外链url对应系统对访问做判断时就会提示The HTTP request is not acceptable for the requested resource甚至403 Forbidden等报错信息。

解决办法:

添加如下参数

noopener=yes,noreferrer=yes

window.open('url','noopener=yes,noreferrer=yes');

 

posted @ 2022-07-05 16:05  诟笑  阅读(1836)  评论(0编辑  收藏  举报