问题描述,打开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>');