I have two asp.net web pages named Default.aspx and Default2.aspx. There is one ASP Button on Default.aspx page. On click of the button event, I am redirecting to Default2.aspx page. On this page there is one HTML input button for closing this Default2.aspx page. I was not able to perform this in IE but it fails in Google Chrome and Firefox browsers. Here is my code to open Default2.aspx page:
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
On Default2.aspx page, I am handling onClick event to close this window. Here is my code spinet for the same:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function Close() {
window.close();
}
</script>
</head>
<body>
<form runat="server">
<input type="button" onclick="Close();" value="Close me"/>
</form>
</body>
</html>
I have gone through following references and tried each and every possible solutions suggested in this links. Here they are:
Issue with window.close and chrome
window.close() doesn't work - Scripts may close only the windows that were opened by it
Chrome “Scripts may close only the windows that were opened by it” error
window.close and self.close do not close the window in Chrome
I have looked into the Development tools and found there is an warning quoted "Scripts may close only the windows that were opened by it." NOTE: This will work in Internet Explorer but not in other browsers.
Can anyone have faced the same issue and found any solution? Kindly help me. Any help would be appreciated. Thanks