mahesh247
mahesh247

Reputation: 301

Is it possible to return value with javascript:window.print()?

I'm trying to save the value as 1 if it succeed (return true) and 0 it it failed (return false) in the database.

Upvotes: 2

Views: 2925

Answers (2)

MrCode
MrCode

Reputation: 64536

No, window.print() is a void, it doesn't return a value and so you can't determine if the dialog was opened or indeed whether or not the document was actually printed.

Related - there is an onafterprint event but it is not currently cross-browser.

From MDN:

Some browsers (including Firefox 6 and later and Internet Explorer) send beforeprint and afterprint events to let content determine when printing may have occurred. You can use this to adjust the user interface presented during printing (such as by displaying or hiding user interface elements during the print process).

Upvotes: 2

Edwin Alex
Edwin Alex

Reputation: 5108

The print dialog box is part of the operating system. Javascript can only access items that are part of the web page.

Upvotes: 0

Related Questions