0

I have used a form submit (post method) in which form is submitted in new window of the browser, as form's attribute target is set to _blank. I want to do some code as soon as the new window is closed.

I want to know how can we handle the close event of the new window, so that I can perform the next operation.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • 1
    Might be helpful: https://stackoverflow.com/questions/24592827/detect-new-tab-closing-from-parentopener – Pete Jul 18 '19 at 13:44
  • @pete Thanks. Updated the question. Actually in my case window opens after form is submitted clicking on button, with the post method. I am not being able to track the new window. So if can get the access to that new window, I may get ahead to handle the close event. – Kalpashree V. Bal Jul 18 '19 at 14:02
  • 1
    You need to open the window first, then post the form to that window. You need that to provide the JS reference to the new window. Pete's suggestion is a good one. Then don't use "_blank", use the named window reference. – Diodeus - James MacFarlane Jul 18 '19 at 14:13
  • Thanks @Diodeus-JamesMacFarlane. Did the same. Worked for me. – Kalpashree V. Bal Jul 19 '19 at 06:26

0 Answers0