How to disable popup "The webpage you are viewing is trying to close the tab"?

Arsalan afzal 0 Reputation points
2024-04-29T12:25:17.9633333+00:00

I am trying to open a web application in MS Edge in IE compatibility mode. Everytime I launch the application, a popup comes saying "The webpage you are viewing is trying to close the tab. Do you want to close this tab?"

Application works fine after clicking "Yes".

The popup is not generated if I launch the same application on Internet Explorer.

 

Is there a setting in Edge to disable this popup?

Image

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,181 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jinxin Wang (Shanghai Wicresoft Co Ltd) 1,145 Reputation points Microsoft Vendor
    2024-04-30T06:51:21.5433333+00:00

    Hi @Arsalan afzal,

    After I tested it, as you said, the popup is not generated if I launch the same application on Internet Explorer.

    In IE mode, you can add the window.open() method and reference the "_self" attribute to disable this pop-up in the window you want to close.

    Here is part of the code I debugged:

    <script>
    
    window.onload = function() {
    window.open('', '_self');
      window.close();
    }
    </script>
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.

    Best regards,

    Jinxin Wang

    0 comments No comments