Forum Discussion

gurhangulmez's avatar
gurhangulmez
Contributor
2 years ago

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:

     

  • NilsD's avatar
    NilsD
    Khoros Staff

    As sent to you directly you can add it here: