The onBeforeUnLoad event does not fire after the PDF is loaded and displayed in iFrame.

Copper Contributor

Hello, our web application requires the confirm-to-leave dialog when closing a browser window. We’ve registered onBeforeUnLoad event to our web page and it works fine. The confirm-to-leave dialog will be popped up when Click “X” icon to close the window (see image at step 3).

 

However, after we load and display the PDF in iFrame then Click the “X” icon (see image at step 5), the browser window will be closed without displaying the confirm-to-leave dialog. This problem does not occur with IE11.  Please see our sample code in attached.

 

Question: How to display the confirm-to-leave dialog after loading PDF file to iFrame?

 

Steps to simulate the issue:

1. Unzip the attached onBeforeUnLoadIssue.zip

2. Run the MainPage.html in MS Edge

3. Click the “X” icon, the confirm-to-leave dialog will be popped up.

ChayankiatTI_0-1584523528117.png

4. Click the “Stay” button” on the confirm-to-leave dialog.

5. Click the “My PDF” link to open the PDF file in iFrame, after the PDF file is loaded to iFrame then Click the “X” icon again.

ChayankiatTI_1-1584523528146.png

6.The browser is closed without displaying the confirm-to-leave dialog.

 

Our Environment:

Windows 10, 1803 (OS Build 17134.1246)

ChayankiatTI_2-1584523528153.png

MS Edge, Version 42.17134.1098.0

MS EdgeHTML 17.17134

ChayankiatTI_3-1584523528155.png

Thank you.

4 Replies
Hi, welcome to the community!
I see you're using the legacy Edge which is discontinued. have you tried the new Edge browser which is based on Chromium engine?
You can download the stable/release channel from here:
https://www.microsoft.com/en-us/edge/

and insider channels from here:
https://www.microsoftedgeinsider.com/en-us/download/

there is a high chance the problem doesn't exist in it.

@HotCakeX 

Thank you. 

 

Per you suggestion, our code works fine with the Chromium Engine base. 

 

According to our organization policy, we need to stay on this legacy Edge for another while.  Do you have any suggestion for a workaround while we need to stay on this legacy Edge?

 

Regards,

ChayankiatTI

I understand, no actually I don't but maybe someone else could help you

@ChayankiatTI Thanks for reaching out!

 

I'll ask one of our Devs and let you know if they have any insights.

 

Fawkes (they/them)
Project & Community Manager - Microsoft Edge