Help opening specific link on page but not others
Show an example of a link that should be opened.
I don't use jQuery, but in JavaScript, maybe this would resolve the problem with the first two patterns:var matchingLinks = document.querySelectorAll('a[href^="' + baseUrl + '"],'a[href*="/' + baseUrl + '"]');
In your loop, you can check for and skip over the third pattern
Show an example of a link that should be opened.
I don't use jQuery, but in JavaScript, maybe this would resolve the problem with the first two patterns:var matchingLinks = document.querySelectorAll('a[href^="' + baseUrl + '"],'a[href*="/' + baseUrl + '"]');
In your loop, you can check for and skip over the third pattern
You have helped many times in the past Jeff but I have yet to actually sit down and learn to code on my own. I am just pretty good at modifying what others set out for my own needs. So I am lost when you say it that way.
Well, since the href
attribute starts with the required string, try using ^
instead of *
:
var matchingLinks = $( "a[href^='" + baseUrl + "']" );
BTW in modern browsers you can use ES6 template strings via backticks:
var matchingLinks = $( `a[href^="${baseUrl}"]` );
Help opening specific link on page but not others
I am trying to open specific links on the webpage. There is exactly 100 that should be opened yet when I run this script:
I end up with 405 pages being opened. What I need is to block out these links:
userdetails.php?id= smalldetails.php?id= details.php?id=21361&hit=1&filelist=1 (with this one the number varies so I bring that to your attention)