2

Suppose I have Parent Page.

Click

When I click on Print a new tab (page) is opened for print preview.

What I want is when I click on print an overlay should be shown on parent tab (page) to stop further work until child tab is closed.

Because when print tab (page) (child) is opened, most of the functions on parent tab (page) are not working properly.

Note: I am using Google Default print/preview functionality.

I am not be able write the code to perform the above described scenario. How can I detect in parent page that its child page is closed?

Jonny C
  • 1,943
  • 3
  • 20
  • 36
Waqar Ahmed
  • 1,414
  • 2
  • 15
  • 35

1 Answers1

0

You can use dialog in jQuery follow this link to view or you might use in your code like

var childNode= window.open('/uri of child');

then use

childNode.onunload = function(){  
// code after child closed
}

if not then you can also try

window.onunload = function() {if(!window.opener.closed && childNode.closed){
//code after child closed
}}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Suyash Kumar Singh
  • 173
  • 1
  • 2
  • 10