Skip to main content

Notifications

Announcements

No record found.

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

Posted on by Microsoft Employee

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How can we close all the tabs opened in a browser when any one tab is closed.This needs to be done using javascript

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How can we close all the tabs opened in a browser when any one tab is closed.This needs to be done using javascript

    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
    Community Member Microsoft Employee on at
    RE: How can we close all the tabs opened in a browser when any one tab is closed.This needs to be done using javascript

    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.

  • Suggested answer
    Wayne Walton Profile Picture
    Wayne Walton 13,726 on at
    RE: 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 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
    Community Member Microsoft Employee on at
    RE: How can we close all the tabs opened in a browser when any one tab is closed.This needs to be done using javascript

    Refer this: stackoverflow.com/.../get-urls-of-all-open-tabs-in-chrome-and-send-it-to-a-web-service

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How can we close all the tabs opened in a browser when any one tab is closed.This needs to be done using javascript

    Instead of closing all tabs close the whole window.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How can we close all the tabs opened in a browser when any one tab is closed.This needs to be done using javascript

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How can we close all the tabs opened in a browser when any one tab is closed.This needs to be done using javascript

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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans