Jump to content
  • Windows 10 Forums

    Welcome to the Windows 10 forums, a free community where people just like you come together to discuss, share and learn how to use their computers.

    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. 

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


CHOI

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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

    • There are no registered users currently online
×
×
  • Create New...