• Welcome to Windows10Forum.com, a free community where people just like you come together to discuss, share and learn how to use their computers. Using this forum is easy and fun. As a guest, you can browse and view all the content on the site, however, you won't be able to leave comments or create new topics unless you create a free account. 

    Click here to Register a free account now and JOIN the discussion!

CHOI

alert does not work when beforeunload in IE(after the RS5)

Recommended Posts

Hello

This issue occurred In Internet explorer 11 after the RS5(REDSTONE 5 / OS version 1809 / xx.xxx.17763.x ) update. 

I would like to know more about this issue.

The following Javascript works when RS4(IE11) or lower, But does not work from RS5(IE11).

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(This is similar to pseudo code.)

window.onbeforeunload = X();

function X() {

/// to-do

.....

save(); // save logic when this pop-up window beforeunload. // not work from RS5(it works when RS4 or lower version)

alert('are u sure ?'); <<<<< // this alert does not work from RS5(it works when RS4 or lower version)

....

return;

}

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

So I changed the JavaScript as follows.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(This is similar to pseudo code.)

window.addEventListener("beforeunload", X);

function X(e){

e.returnValue = 'are u sure?'; // work in All of IE version

//to-do 

save(); // work in All of IE version

console.log('are u sure?'); // work in All of IE version

alert('are u sure?'); // work in RS4 or lower  version but it still does not work in RS5

}

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

As a result, JavaScript works except alert.

I want to know that whether this is the best method and whether there is an official document on this situation.

If you know this situation, please reply.

Thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Who's Online   0 Members, 0 Anonymous, 18 Guests (See full list)

    There are no registered users currently online