Open window by window.open and print it with window.print on load
<p>I have some code like </p>

<pre><code>var windowObject = window.open('','windowObject','arguments...');
windowObject.document.write("&lt;html&gt;&lt;body onload="alert(1);window.print();alert(2);"&gt;&lt;div&gt;some html&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;");
</code></pre>

<p>The problem is that everything works except the window.print event (on ie, on firefox, it's working).</p>

<p>Is there a workaround?</p>

<p>Thanks in advance,
Gaurav</p>
