I use GeckoFx to capture an image of a web page. The problem is that this web page has a script:
<script language = "JavaScript">
window.print (); window.close ();
</ script>
The above script opens a print dialog box and requires interactive user input to continue.
Question: How do I automate the process - for example say by stopping the dialog from opening.
Is there a way to disable the native javascript printing method (window.print
)?
I already tried to inject a script into the html header:
window.print = function () {}
But this does not work. it inserts the script but the dialog box keeps showing up. (I do it in the DocumentCompleted
event).
I found how to disable window.alert
using PromptServiceCreator
, but I can not disable window.print
I do not care about window.close
because it does not run (firefox does not run it).