gurhangulmez
2 years agoContributor
Injecting a Js code after page load
How can I inject the JS code below after page is loaded?
The page is https://community.booking.com/*
The aim is adding aid=2046495 to all links out to booking.com.
I couldn't find the right place as you can see in the screenshot below.
$("a").filter(function() {
return $(this).attr('href').match(/^https?:\/\/([^/]*\.)?booking\.com(\/.*|$)/i);
}).each(function() {
var href = $(this).attr('href');
if (href) {
var url = new URL(href);
url.searchParams.set("aid", "2046495");
$(this).attr('href', url.href);
}
});
As sent to you directly you can add it here: