Error Message: document.write is disallowed in JSFiddle

Nishantha picture Nishantha · May 28, 2013 · Viewed 9.9k times · Source

When I try to run one of my JavaScript files on JSFiddle, I get the following error message:

document.write is disallowed in JSFiddle environment and might break your fiddle.

How do I fix this issue?

Note: When I use external resources, it works fine. But I want to use the JavaScript panel for scripts.

Answer

skibulk picture skibulk · Dec 7, 2014

Here's one alternative: http://jsfiddle.net/skibulk/erh7m9og/1/

document.write = function (str) {
    document.body.insertAdjacentHTML("beforeend", str);
}

document.write("¡hola mundo");