Last active
March 3, 2022 09:50
-
-
Save adelin-b/7061093b0f442ac693a122202c23cc62 to your computer and use it in GitHub Desktop.
Click all link on a page matching regex or css selector and open in new tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// same in a function | |
function openAllLinksInNewTab() { | |
document.querySelectorAll(selector).forEach(function(a) { | |
a.target = '_blank'; | |
// click it | |
a.click(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment