0

Writing into the DOM using Javascript documentwrite()

I have some HTML code in a JavaScript variable. Suppose: let htmlCode = `<div>.....</div>` And the html code is displayed in required placed using document.write(htmlCode) But I need to do this without letting the person's that view the page source code that the code is actually written using document.write(). How, can I do this in such a way that it will write the code on same place where the JS code is placed and source code viewer won't know how the HTML code is being printed. I am pasting this code where I want the html code: script let htmlCode = "some HTML code in obfuscated form`m'; document.write(htmlCode); /script Any ideas.

16th Dec 2020, 5:55 AM
Bibek Oli
Bibek Oli - avatar
2 Réponses
+ 4
you can use encryption like I have used in this https://code.sololearn.com/W1HytmSMVYu1/?ref=app here you can see on the js tab
16th Dec 2020, 6:13 AM
Krish
Krish - avatar
+ 1
I don't know how about js, but in django it is called template rendering What about to use react?
16th Dec 2020, 6:53 AM
Shadoff
Shadoff - avatar