Monthly Archives: January 2011

Javascript window.print() does not work in Opera/Chrome browser

You need a timout before calling print in Opera and Chrome (Netscape). Here’s the solution:

function init() {
var objBrowse = window.navigator;
if (objBrowse.appName == “Opera” || objBrowse.appName == “Netscape”) {
setTimeout(‘window.print()’, 1000);
} else {
window.print();
}
}
window.onload = init;

Source http://www.webdeveloper.com/forum/archive/index.php/t-105277.html