cancel
Showing results for 
Search instead for 
Did you mean: 

Display popup window when closing "X" web browser

Former Member
0 Kudos

Hi All - how I can display a popup window when user press "X" from web browser.

I know how to create popups windows but where I can code the popup window when the user close the browser?

e.g. I press at the top right the web browser "X" to close the browser, how I can display a popup asking if they want to SAVE the data before closing the browser.

thanks!

-Jason PV

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi All - I can reproduce this in standard SAP screen, e.g opening the Create a Shopping Cart and then click the "X" to close the browser -


A popup displaying asking if I want to leave the screen without saving OK and CANCEL if I click OK it will close the browser but if click CANCEL it will ignore the action and still display the screen so the user can continue or SAVE the shopping cart.

I tried using the WDDOEXIT method but this gets trigger after the window has been close, I want to stop the ACTION same way SAP does.

Any idea?

thanks!

Jason PV

Former Member
0 Kudos

Hi,

I know of the way, how it works when your WD application is run in Portal Environment.

Portal has something called as Work Protect Mode by virtue of interface IF_WD_PORTAL_INTEGRATION.

In you application you have to first get portal instance, then set the work protect mode accordingly, then set the is_dirty flag provided by interface to true or false.

Sample Implementation can be found in WD Component: WDR_TEST_PORTAL_PROTECT ( although it will not work if run normally, can be tested by creating an Iview around it and calling it inside Portal ), nevertheless you can have a look at the code.

Regards

Manas Dua

ChrisPaine
Active Contributor
0 Kudos

Hi Manas,

are you sure?

If you close the browser window - even if you have set the portal work protect mode, set the app as dirty and running the app in the portal - the windows closes without any complaint.

If you were in the portal and tried to navigate away from the page, that would be a different thing - but a browser close is just that. You can capture the onUnload event of the browser window (not in WD - but JS) but you have no way of detecting that it is not just a page refresh.

Do a search for "intercepting browser close events" via google etc, to see just how tricky to build a solution would be.

So I'd say - no ability to stop browser close events - or to react to them - but yes to portal navigation type event within the portal. And further to that - I'd suggest using the FPM work protect mode interface to help you take advantage of the Portal work protection.

Cheers,

Former Member
0 Kudos

Manas I applied suggestion and when closing the browser it wasn't stopping to close the browser, the dirty flag worked for me in a custom close button tied to an "EXIT" plug.

I can see that the popup that is displaying in the screen when pressing "X" in standard SAP is an internet explorer popup window.

thanks for all your help!

Jason PV

Former Member
0 Kudos

Hi Jason,

Can you have a look at below mentioned thread and give your solution:

Regards

Manas Dua

Former Member
0 Kudos

Close question since there's other question open in the same topic.

thanks!

Jason PV

Answers (0)