Open Mazedotexe opened 5 months ago
That is weird. The entire webpage just goes white like the white screen of death.
i mean thats because that completely clears the document. if you really want it to be added back though you can do something like this to override the document.write function and make it re-add eruda after the clear:
let oldFunc = document.write; document.write = function (...args) { if (args.length === 0) { //it cant be empty or it just doesnt work so it adds a useless <i> tag if no arguments are given args = ["<i>"] } oldFunc.apply(this, args); //reload eruda let script = document.createElement("script"); script.src = "https://cdn.jsdelivr.net/npm/eruda"; document.head.append(script); script.onload = function () { eruda.init(document); }; };
i dont know why i even did this
i mean thats because that completely clears the document. if you really want it to be added back though you can do something like this to override the document.write function and make it re-add eruda after the clear:
let oldFunc = document.write; document.write = function (...args) { if (args.length === 0) { //it cant be empty or it just doesnt work so it adds a useless <i> tag if no arguments are given args = ["<i>"] } oldFunc.apply(this, args); //reload eruda let script = document.createElement("script"); script.src = "https://cdn.jsdelivr.net/npm/eruda"; document.head.append(script); script.onload = function () { eruda.init(document); }; };
i dont know why i even did this
Sure, I could. But the problem isn't necessarily that document.write specifically causes problems that I don't want; the problem is that "document" refers to the entire document, including Eruda, and this can cause problems in many ways, that being one of them. Also, I don't think anybody actually uses document.write and would care enough to use a script like the one you provided.
This is just a silly little bug I found, not very important. But
document.write()
really does affect the entire document, including Eruda. You also cannot bring it back after writing. I'm sure this is an easy fix, but I could be wrong. Thanks!