+ 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); }());

3rd Jan 2018, 5:31 PM
vortetty
vortetty - avatar
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
7th Nov 2017, 6:26 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 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.
3rd Jan 2018, 5:45 PM
John Wells
John Wells - avatar
+ 1
Your code should be working.
4th Jan 2018, 1:32 AM
Calviղ
Calviղ - avatar
+ 1
this takes a js file, i need an html file
6th Jan 2018, 7:11 PM
vortetty
vortetty - avatar
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>
7th Nov 2017, 2:30 PM
vortetty
vortetty - avatar