Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Javascript Printing in IE4 and Web Browser Control


Message #1 by rturner003@v... on Tue, 20 Nov 2001 08:15:04
In IE4 the window.print command will not work. After trawling the net I 
came accross many routines, which were mostly just variations on a theme. 
The main thing was that they used the web browser control to print. 
However when I tried them I got 'Command no known' (or similar) to the 
command to print. This is an example of one of the routines:

<SCRIPT Language="Javascript"> 
function printthis(){ 
if (window.print) {
window.print() ; 
} else {
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 
CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box 
WebBrowser1.outerHTML = ""; 
}
}
</script>

Has anybody any idea why IE4 will not accept this command?

Robert

  Return to Index