catching window close event in HTA

P

philippe.laplanche

Hi

In the following code I wish that the myunload function is called when
I click on the "close" link or when I close the window using the
standard way.
It works in IE 7 but not in hta environment. Is there another way to
catch this event in hta environment ?

thanks

Philippe

<html>
<head>
<HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="TEST"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
CAPTION="yes"
BORDER="dialog"
BORDERSTYLE="normal"
INNERBORDER="no"
CONTEXTMENU="yes"
NAVIGABLE="yes"
SCROLL="no"
SCROLLFLAT="no"
SELECTION="yes"
WINDOWSTATE="normal"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"<script type="text/javascript">
function myunload() {
alert("closing");
}
window.onunload = myunload;
</script>
</head>
<body>
<a href="javascript:window.close()">close</a>
</body>
</html>
 
S

scripts.contact

It works in IE 7 but not in hta environment.

Post here :
microsoft.public.inetexplorer.scripting
or
microsoft.public.scripting.jscript
Is there another way to
catch this event in hta environment ?

Use onbeforeunload event



<HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="TEST"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
CAPTION="yes"
BORDER="dialog"
BORDERSTYLE="normal"
INNERBORDER="no"
CONTEXTMENU="yes"
NAVIGABLE="yes"
SCROLL="no"
SCROLLFLAT="no"
SELECTION="yes"
WINDOWSTATE="normal"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"

why are you using the HTA tag(you are using all the default
values) ??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top