Is there any way to count number of tabs are opened in chrome?

后端 未结 4 697
心在旅途
心在旅途 2021-01-13 04:18

I am trying to find a way to count a number of tabs that are currently open in Chrome by javascript.

I have searched and found chrome.tabs.query(). But when I opened

4条回答
  •  终归单人心
    2021-01-13 05:07

    I found the answer to this question here: https://superuser.com/questions/967064/how-to-get-tab-count-in-chrome-desktop-without-app-extension

    Go to chrome://inspect/#pages

    Run the following line of code in the javascript console:

    document.getElementById("pages-list").childElementCount
    

    The tabs count will be printed to the console.

提交回复
热议问题