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

About these ads

3 thoughts on “Javascript window.print() does not work in Opera/Chrome browser

  1. cmujica

    No me funcionó, esto si
    onclick=”JavaScript:window.print();return false;”

    Gracias de todas maneras

    Reply

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s