Open
Description
Can you please add a checkbox to run the code in the context of the page?
Here's how to do it:
// script tag to inject into the document
scr = document.createElement('script');
// set code as text (function automatically converted to text)
scr.textContent = '(' + function() {
console.log(jQuery); // for example here we can use the page's jQuery object
} + ')();'
console.log('injecting script tag:', scr); // may be required (or it won't be loaded in the page for some reason)
// insert the code in the page
(document.head || document.documentElement).appendChild(scr);
// optionally hide the script tag from the page (you could make it a checkbox too)
// scr.parentNode.removeChild(scr);
Metadata
Metadata
Assignees
Labels
No labels