web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How can we close all the tabs opened in a browser when any one tab is closed.This needs to be done using javascript

(0) ShareShare
ReportReport
Posted on by

How can we close all the tabs opened in a browser when any one tab is closed.This needs to be done using javascript

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    There is an event called tabstatechange which can be used here. Refer: community.dynamics.com/.../tab-state-change-event-crm-javascript

  • Community Member Profile Picture
    on at

    I need to close all the tabs on browser, when one of the tabs is closed

  • Community Member Profile Picture
    on at

    Instead of closing all tabs close the whole window.

  • Community Member Profile Picture
    on at
  • Suggested answer
    Wayne Walton Profile Picture
    13,730 on at

    This doesn't really seem like a CRM question.

    Also, JavaScript can't arbitrarily close browser tabs.  This is a security feature you don't want to override.  Furthermore, you don't control the close button of the browsers themselves, so closing other tabs from the event of closing a browser tab is well beyond your control, especially when different browsers have different tab implementations. OnUnload does something like that, but it can't tell the difference between a tab closure, a page refresh, or other session changes.  You would certainly get unexpected behavior if you tried to hijack it to close tabs.

    It can, however, close the current tab and all tabs you have a handle for (essentially all parent tabs of your tab).  But good luck getting all browsers to behave the same way when you use a window.close() event.  And it won't work from someone directly closing the tab itself.

  • Community Member Profile Picture
    on at

    Actually, if multiple CRM tabs are opened in a machine and we close any one of them , then all should close automatically .Is this possible in CRM.

  • Community Member Profile Picture
    on at

    Actually, if multiple CRM tabs are opened in a machine and we close any one of them , then all should close automatically .Is this possible in CRM.

  • Community Member Profile Picture
    on at

    I think you need to get all open tabs in an array and then try to close it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans