Last post May 14, 2020 06:31 AM by yij sun
Member
1 Points
22 Posts
May 13, 2020 08:58 AM|RaghuMasineni|LINK
Hi ,
We are using HTA file in one of our legacy application.we are saving the file to exe and performing all operations as browser.
Here I am using below code to close the HTA file on click of button in code behind file,
Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.close()", true);
But this is not closing the application and just showing a blank screen which is understandable as it is running as an exe.
Is there any way to close HTA file programatically ?
Thanks,
Raghu.
May 13, 2020 10:23 AM|RaghuMasineni|LINK
I am able to close the HTA file from javascript with out any issues
<input type="button" onclick="window.close();" value="Close this window" id="Button1" name="Button1">
Regards,
Contributor
4050 Points
1575 Posts
May 14, 2020 06:31 AM|yij sun|LINK
Hi RaghuMasineni,
Accroding to your description,as far as I think,you could use window.open('close.html', '_self', null);
More details,you could refer to below codes:
<head> <meta charset="utf-8" /> <title></title> <script language="javascript" type="text/javascript"> var redirectTimerId = 0; function closeWindow() { window.opener = top; redirectTimerId = window.setTimeout('redirect()', 2000); window.close(); } function stopRedirect() { window.clearTimeout(redirectTimerId); } function redirect() { window.location = 'WebForm37.aspx'; } </script> </head> <body onload="closeWindow()" onunload="stopRedirect()" style=""> <center><h1>Please Wait...</h1></center> </body>
protected void Button1_Click(object sender, EventArgs e) { ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.open('close.html', '_self', null);", true); }
Best regards,
Yijing Sun
Member
1 Points
22 Posts
How to close HTA exe programatically
May 13, 2020 08:58 AM|RaghuMasineni|LINK
Hi ,
We are using HTA file in one of our legacy application.we are saving the file to exe and performing all operations as browser.
Here I am using below code to close the HTA file on click of button in code behind file,
Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.close()", true);
But this is not closing the application and just showing a blank screen which is understandable as it is running as an exe.
Is there any way to close HTA file programatically ?
Thanks,
Raghu.
Member
1 Points
22 Posts
Re: How to close HTA exe programatically
May 13, 2020 10:23 AM|RaghuMasineni|LINK
I am able to close the HTA file from javascript with out any issues
<input type="button" onclick="window.close();" value="Close this window" id="Button1" name="Button1">
Regards,
Raghu.
Contributor
4050 Points
1575 Posts
Re: How to close HTA exe programatically
May 14, 2020 06:31 AM|yij sun|LINK
Hi RaghuMasineni,
Accroding to your description,as far as I think,you could use window.open('close.html', '_self', null);
More details,you could refer to below codes:
protected void Button1_Click(object sender, EventArgs e) { ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.open('close.html', '_self', null);", true); }
Best regards,
Yijing Sun