Issue
I want to create a link on a webpage that would close current active tab in a browser without closing other tabs in the browser. When user clicks close link, an alert message should appear asking user to confirm with two buttons, "YES" and "NO". If user clicks "YES", close that page and go to the parent tab and if press s no do nothing.?
It's kind of bad flow but i am searching for a solution.
Solution
try this: this may close the current tab for you.
if (confirm("Close Window?")) {
window.top.location.reload(true);
window.top.close();
}else{
// write down code the code that you want ot execute on clicking on " No ".
}
Answered By - Himesh Aadeshara
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.