Answers for "how to inject javascript script into website"

3

inject javascript to webpage

$.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);
    }
});
Posted by: Guest on November-15-2020

Code answers related to "how to inject javascript script into website"

Code answers related to "Javascript"

Browse Popular Code Answers by Language