TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Smile
1.5k
202
37k
Event to know when a browser is closed
Feb 3 2020 5:44 AM
I have a website with mutliple tabs and with multiple menu items with a master page.How to know when the browser/tab is closed.I need to close a thread on browser close.
I Haved tried this event
<script type=
"text/javascript"
>
window.addEventListener(
'beforeunload'
,
function
(e) {
e.preventDefault();
e.returnValue =
''
;
});
</script>
This event is getting invoked when i am moving from one tab to other and even from one menu item to other.I want to know only when the the browser/tab is getting closed.
Reply
Answers (
3
)
ASP.NET MVC EDIT VIEW validation
GetExternalLoginInfoAsync error method