Discussions » Creation Requests
Auto open URLs on certain pages
Yes, I think Chrome doesn't allow that, you'll need to call the function the is built in your scripts manager "GM_openInTab" instead of "window.open".
Assuming that this script is working but not opening tabs in background, instead it opens and focuses the tab.
Yeah, discord doesn't allow this due to it may be dangerous.
Auto open URLs on certain pages
Hi -- I am looking for a script that will result in opening all URLs on a page from a specific site in new tabs or windows (doesn't matter). I have found the script below but it doesn't seem to work. Is Chrome not allowing this kind of behavior?
Thanks for your help!
// ==UserScript== // @name Open links in background window // @author Lex1 // @version 1.4 // @description Sets links in a page to open in new background window. // @include https://www.testpage123xyz.com/* // @exclude http://mail.google.com/* // @exclude https://mail.google.com/* // ==/UserScript==
function click_ujsenabled(e) { var a = e.srcElement; while (a.nodeName != 'A' && a.nodeName != 'HTML') { a = a.parentNode; } if (a.href && a.protocol != 'javascript:' && a.getAttribute('href')[0] != '#') { window.open(a.href, '_blank').blur() e.stopPropagation(); e.preventDefault(); } };
document.addEventListener('click', click_ujsenabled, false);