M
M
mortefy2018-05-19 17:49:00
JavaScript
mortefy, 2018-05-19 17:49:00

How to add custom code before page load using chrome extension?

I need to add a button on a website using a google chrome extension. It is necessary that the button starts to be displayed before the page is fully loaded. How to do it?
Now I do this - I load the js file to this site:

$(function () {
if ($(location).attr('pathname').search('(prd/)') != -1) {
        $("div[id=shipping-restrictions]").after('<div id="forprices"><button id="startBtn" onClick="this.disabled=\'true\'"  type="button" class="buttonFunc">Start</button></div>`);
    }
});

But the button appears after the page is loaded, but how to do it humanly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FRF, 2018-09-12
@frf_nn

it is probably possible to make the button part of the browser window, not the page

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question