I’m trying to detect ?=randomString (e.g: ?=s123ver which is dynamically generated server side) in the URL and append everything after the ?= to all external links in the page with the class external.
This is what I’ve got to append the string, I’m just not sure about how to go around reading the URL and putting it into the _randomString variable, as the ?= string length can vary.
I have no access to server side.
var _href = $("a.external").attr("href");
var _randomString = ???
$("a.external").attr("href", _href + _randomString);
Try this
It will get you everyting after ?= till the end of the URL, extract it and append it to the href of every
a.externalIf you need to include the ?= part (you didn’t say so), try this