Can't submit form within "onbeforeunload" event using Edge

Ligong Zhu 21 Reputation points
2021-09-29T13:11:11.277+00:00

Hi,

We have javascript code to submit html form inside "onbeforeunload" event using IE and it has been working fine for years. But the same code is not working after switching to Edge browser and the problem is the form submit. Do you have any suggestion how to make html form submit working in "onbeforeunload" using Edge?

We need this function because we want to save page page after users click red 'X' button on the top right corner.

Thanks.

Ligong

Microsoft Edge Microsoft Edge development
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2021-09-30T06:46:28.167+00:00

    Hi @Ligong Zhu ,

    According to your description, I created a simple demo and reproduced this issue your mentioned. And I found this problem in both Chrome and Edge. But it does work very well in IE. According to this situation, I recommend you to use Edge IE mode.

    Just simple settings: settings and more ( ... ) -> Settings -> Default browser -> turn on the option Allow sites to be reloaded in Internet Explorer mode to Allow. And then you could reload the page in IE mode. And use it like this:

    MTZRC.png

    In addition, for this issue, you could also send feedback to the relevant team via this link.

    Hope this can help you.

    Best regards,
    Xudong Peng


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Ligong Zhu 21 Reputation points
    2021-10-04T18:54:18.19+00:00

    Thank you very much for the quick response In that case, is it possible to disable or hide red X button from Edge so that users can't use it, or is there another event we can use to submit current form when users click on this red X?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.