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

Announcements

No record found.

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans