+ 1
Make js import HTML
I need to make a js file import an HTML file, The catch is it needs to be Abel to be ported in by this code and run pulling in a full HTML file with CSS3 and JS javascript: (function () { var jsCode = document.createElement('script'); jsCode.setAttribute('src', 'http://path/to/external/file.js'); document.body.appendChild(jsCode); }());
5 odpowiedzi
+ 5
I think it is more convenient for a HTML file to load a JS file instead, but depends on the function, so yeah
+ 2
You could read context of HTML file and write it's contents using document.write. This doesn't guarantee that everything gets set up the same as a document originally loaded by browser. But, it will be processed and set up similarly.
+ 1
Your code should be working.
+ 1
this takes a js file, i need an html file
0
I am writing an injection code to change the website using a bookmark, so I need it to insert an external html file into the pages <body>