I don't think that there is a write method on the window object. There is document.write() method, it may work in some browsers but it is deprecated as per MDN.
I am interested to know how window.write() works for you.
If you are still interested in knowing how to use document.write, attaching a snippet here.