Web Page script closing window causes undesired pop up

Solution Available
Tyler G.
Lititz, PA

Jan 14, 2011
19 Posts

1  |  0  

Re: Web Page script closing window causes undesired pop up

I am navigating web pages in my code using an Alog control and the last page I load has a script that wants to close the window when its done. When it tries to close the window a message pops saying "The webpage you are viewing is trying to close the window. Do you want to close this window?"

I don't want this message to pop up, I just want it to close the window with no message. I tried to set the log's .silent property to true but the message still comes up. Does anyone know of a way to avoid this message?

DrATEasy (Ron Y.)
Mission Viejo, CA

Jan 14, 2011
358 Posts

0  |  0  

Re: Web Page script closing window causes undesired pop up

You can nagigate to a fake URL and override the ALog.OnNavigate() event to close the form using ATEasy code (Unload Form) when the sUrl parameter is the same as the fake URL.

Tyler G.
Lititz, PA

Jan 17, 2011
19 Posts

0  |  0  

Re: Web Page script closing window causes undesired pop up

The pop up that appears is the same as the message box procedure. The window is completely disabled until the user clicks on an answer. So even if I put a line to navigate to the fake URL to close the form it wouldn't run until after the message box came up and the user clicked on a response, or it would close the form before the necessary scripts on the page were run.

Tyler G.
Lititz, PA

Jan 17, 2011
19 Posts

0  |  0  

Re: Web Page script closing window causes undesired pop up

Building off of Ron's suggestion. I created a thread to reply 'Yes' when the message box popped up. Because the code in the thread does not suspend when the message box is presented this allows me to allow the web page to fully load and reply to the pop up after it is presented.

DrATEasy (Ron Y.)
Mission Viejo, CA

Jan 17, 2011
358 Posts

0  |  0  

Re: Web Page script closing window causes undesired pop up

Seems like it works for you. I tried the following and it works:

Try also the OnBeforeNavigate() event to catch the URL before it attempts to do it:

ALog1.OnBeforeNavigate(...)
{
if pvURL="http://www.yahoo.com/"
Unload Form
endif
}

The HTML document I had:

<form method="post" action="http://www.yahoo.com" >
<input name="Buton1" type="submit" value="Jump"/></form>

Ronnie



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]