Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/466.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 哪种java脚本或jquery方法允许我们使用noopener noreferrer和target\u blank基于url打开网页_Javascript_Html_Css_Ss - Fatal编程技术网

Javascript 哪种java脚本或jquery方法允许我们使用noopener noreferrer和target\u blank基于url打开网页

Javascript 哪种java脚本或jquery方法允许我们使用noopener noreferrer和target\u blank基于url打开网页,javascript,html,css,ss,Javascript,Html,Css,Ss,有以下多种方法可以使用URL打开页面: window.location.replace(“http://example.com"); // 用替换现有页面的历史记录替换现有页面 window.location.assign('http://example.com","空白",; 打开窗户http://www.example.com","空白",; window.location=”http://example.com"; window.location.href=”http://example

有以下多种方法可以使用URL打开页面:

window.location.replace(“http://example.com"); // 用替换现有页面的历史记录替换现有页面
window.location.assign('http://example.com","空白",;
打开窗户http://www.example.com","空白",;
window.location=”http://example.com";
window.location.href=”http://example.com";

location.href=”http://example.com"; // 我认为这速度更快
您可以尝试下面给出的代码。它将在单击链接时禁用该链接,并将设置游标和href。希望对你有帮助

var link=document.getElementById('link');
link.addEventListener('click',函数(e){
e、 预防默认值();
this.style.cursor=“不允许”;
this.href=“”;
})

像这样为锚定标记创建一个禁用属性,出于安全原因,也清除锚定标记的
href
属性

let link=document.querySelectorAll(“[disabled link]”);
Array.from(link).forEach((links)=>{
links.setAttribute(“href”,“#”)
links.style.filter=“灰度(100%)”
links.style.cursor=“不允许”
links.style.textdepro饰=“无”
})


你所说的最快是什么意思?如果你指的是页面加载的速度,那么它只取决于你的互联网连接速度,而不是你如何打开一个新标签。我认为如果通过html锚或JavaScript打开,情况也是一样:)