我有一个href需要在新的选项卡中打开,并且不能使用锚点标记,因为它来自webgl上下文。以下内容实现了这一点:
window.open(href, "_blank");
然而,它附带了一个很大的警告,即新选项卡与原始选项卡共享运行时/进程,这对于一个繁重的web应用程序来说会导致资源问题。
我尝试创建一个不可见的锚标记,并通过JS点击它作为一种变通方法:
const anchor = document.createElement("a");
anchor.setAttribute("href", href);
anchor.setAttribute("target", "_blank");
anchor.click();
但Chrome阻止了这一点;弹出";。
肯定有办法做到这一点吧?
我相信;noopener";功能在单独的过程中运行窗口https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener
let d = window.open('https://www.google.com/', 'name', 'noopener=yes');
有了noopener,d现在将为空