inject javascript to webpage
snippet in javascript

inject javascript to webpage

user7331

$.ajax({
    url: `chrome-extension://${chrome.runtime.id}/index.html`,
    success: function(data){ 
        //Simple note: the injected id is there so if you wanted to remove the injection you could do that :D
        document.getElementsByTagName('body').innerHTML += "<script id='injected'>" + data + "</script>";
    },
    error: function(err){
        alert(err);
    }
});