I have a piece of JS code which I want to load into a third-party website (via chrome DOM). How do I go about this without using jQuery (the page has blocked the import of any js libraries)?
Asked
Active
Viewed 242 times
0
-
not sure how a site blocks javascript libraries.... how are you adding this code? console? document.createElement..... – epascarello Nov 03 '18 at 01:31
-
out of curiosity, how do you perceive doing this with jQuery? – Randy Casburn Nov 03 '18 at 01:32
-
This does not make any sense. You want to inject your JS Code into a 3rd party website? Are you using GreaseMonkey or something? Otherwise what you're doing is considered cross site scripting or JavaScript injection. – Twisty Nov 03 '18 at 06:13
1 Answers
1
var script=document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", "http://www.example.com/your/script");
document.body.appendChild(script);

Circuit Craft
- 184
- 2
- 8