Secretly document.write into DOM using Javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Secretly document.write into DOM using Javascript

I have obfuscated HTML code in the form of Javascript code. To display it in page, I do, document.write() and it writes in the page. But the problem is whatever is going to be written using document.write(x), here 'x' is the deobfuscated html code. So, anyone can get the original code stored in x variable. So, is there any way to write into page Javascript. i.e. secret form of document.write() or can we create custom method for it. Here is my obfuscated html code: https://code.sololearn.com/Wo33PNSHb7N9/?ref=app If you alert instead of document.write, it will alert html code.

9th Dec 2020, 4:02 PM
Bibek Oli
Bibek Oli - avatar
1 Answer
0
There is no secret form for document.write. You can simply use an array and use document.write or document.writeln: [ /* Your HTML obsfucated*/ ].map(document.write) Btw you can do SSR, that way your logic will remain only on server
9th Dec 2020, 5:48 PM
anon