问题描述,打开ACfan链接的时候,如果<a href = 'acfan链接'>会出现403错误,

如果<a href = 'acfan链接' rel=noreferrer>带上rel=noreferrer属性就可以正常访问。

现在要求用window.open打开,或者用location.href打开链接:

借鉴:

方法1:使用window.open新开页面,并插入一段javascript,用来重定向到目标页面:

var url = "http://www.baidu.com/"
window.open('javascript:window.name;', '<script>location.replace("'+url+'")<\/script>');

 

方法2:通过指定data:text/html来强制浏览器打开一个指定空页面:

var url = "http://www.baidu.com/"
window.open('data:text/html,<html><body><script>location.replace("' + url + '")</script></body></html>');

 

相关文章:

  • 2021-06-16
  • 2021-08-29
  • 2021-09-18
  • 2021-11-03
  • 2021-12-09
  • 2022-02-26
  • 2022-01-01
  • 2022-12-23
猜你喜欢
  • 2021-06-18
  • 2021-07-16
  • 2021-12-10
  • 2021-05-27
  • 2022-12-23
  • 2021-06-01
相关资源
相似解决方案