I am trying to automate a very manual workflow. To that end, I need to open a specific page containing
workflow_history
in the URL. I need to open it 4 times in 4 different tabs.
I want to automate this in a Tampermonkey script to reduce clicking.
I can't simply save these for links in a bookmark bar folder and open all the links using right-click > open all. The links are always different (entries in a database), but they do always contain
workflow_history
This is what I have:
(function() {
'use strict';
var isWorkflow = /workflow_history/.test(window.location.href);
if (isWorkflow) {
window.open(location.href)
}
})();
The above code results in an endless loop where more and more tabs open until the browser crashes.
I need the script to only open the same page 4 times. How can I stop the loop after 4 iterations?
Ok, I found a somewhat hacky solution:
var allLinks = document.links;
$('body').click(function(){
window.open(allLinks.item(12));
window.open(allLinks.item(13));
window.open(allLinks.item(14));
window.open(allLinks.item(14));
});
This opens the 4 necessary links in the tool I am using on just one click. Note that the numbers of the links (12-14) are specific to the page in my tool.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.