I have some userscripts that use
var tab = window.open('', '_blank');
tab.document.write(myCustomHtml);
tab.document.close();
to show an output to the user (myCustomHtml being some valid HTML I defined previously in the code). It sopped working in Firefox since version 27, now I only get an empty document. No console errors whatsoever.
The newly opened document has only this content when inspected with Firefox' console
<html>
<head></head>
<body>
</body>
</html>
while the source code is empty.
The code works in Chrome.
Do I need to make any modification for newer Firefox versions (27+) and an updated Greasemonkey (1.15)? I haven't found any recent bug reported to Firefox about this issue.
Here's a test script
// ==UserScript==
// @name document.write() test
// @namespace stackoverflow.com
// @description tests document.write()
// @include https://stackoverflow.com/questions/22651334/*
// @include http://stackoverflow.com/questions/22651334/*
// @version 0.0.1
// ==/UserScript==
var tab = window.open('', '_blank');
tab.document.write('<html><head></head><body><ul><li>a</li><li>b</li><li>c</li></ul></body></html>');
tab.document.close();
- a
- b
- c
"` and works for me, maybe it is something related to the html you're trying to use.... wait what about the config in your greasemonkey?: I've tested it in a pure html web page. – Allende Mar 26 '14 at 05:35