none
The webpage you are viewing is trying to close the window

    Question

  • Hi everyone,

    We will pass to IE8 very soon.

    Is it possible to trap the answer of this confirmation popup as below?

    The webpage you are viewing is trying to close the window

    Do you want to close this window ?

    Thanks in advance.

    Bye.

    Thursday, August 25, 2011 8:51 PM

All replies

  • Hi,


    If you tried to close a window using javascript window.close() method in IE7, and as you may noticed a message will prompt "The Webpage you are viewing is trying to close the window. Do you want to close this window". This does not happen with IE6, it's new to IE7. 

    Because of the security enhancements in IE7, you can't close a window unless it is opened by a script. so the walkaround will be to let the browser thinks that this page is opened using a script then closing the window.

    Please check the link below for the similar thread which provides a solutions for the issue: http://stackoverflow.com/questions/601465/the-webpage-you-are-viewing-is-trying-to-close-this-window-warning-in-internet-ex

    hope this helps, thanks.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com
    Microsoft One Code Framework
    Monday, August 29, 2011 3:11 AM
    Moderator
  • Thank you Mr. Yang,
     
    I create a function like this :
     
    function closeTest() 
          {
           if('&REQUEST.'=='QUIT')
           {
             window.location="http://www.******/PORTAL.home";
           }  
          }

    When, I press on "Quit" button, the portal page is appearing to replace application page.
     
    I don't know if it's the best but I think I have a solution.
     
    I also tried code like this one, but I can't catch error:
    try
      {
      //Run some code here
      
      window.location="http://www.******/PORTAL.home";
      }
    catch(err)
      {
      //Handle errors here
      }
     
    My regards. Bye.

    Mr Html-db apex developper
    Wednesday, August 31, 2011 8:26 PM
  • At our office, one of our IE8 versions is hitting the "The Webpage you are viewing is trying to close the window. Do you want to close this window" message, but the other is not.  They're they exact same version of IE, and we're very sure that it's a settings difference, but we have been unable track down the difference.  Does anyone here know which setting it might be that I can toggle?
    Monday, January 30, 2012 5:48 PM
  • Hi,

    tools>Internet Options

    1. Security tab, click "Reset all zones to default"

    2. Compare the listing of sites in the Trusted and Internet Zones..... client machines on different Domains may have different Group Policy settings.

    (scripted windows, viz popups and navigation accross domains is affected by security zone settings.. always accept the default.)

    3. Tools>Popup blocker>Popup blocker settings>a Meduim Blocking level stops most advertisements but still leaves legitimate popups available.

    4. Tools>Compatibility View Settings..... compare the settings between the two machines...

    or

    Display the Developer Tool and compare the Document Mode that the page renders as on both machines.

    the machine that does not display the warning may have "Display all sites in Compatibility View" checked....

    5. test both machines in no-Addons mode to rule out an Addon.

    Regards.

     

     


    Rob^_^
    Wednesday, February 01, 2012 5:24 AM