Why does Chrome change the tabId when entering a new search in the address bar, and then it transfers me to the results of a Google page

I wrote the following simple code on my background script:

chrome.tabs.onActivated.addListener(function (info) {
    console.log(info.tabId);
});

Then I go and open a new tab. Magazines console 73. Then I update the URL of the open tab, nothing is written to the console. However, if I then type something in the address bar on the same tab, and the google results page is open, the new identifier is 77written to the console.

What's going on here?

+4
source share
1 answer

Chrome prerenders . tabId -1, , tabId , Enter/mouseclick. tabId .

Prerendered: chrome.tabs.onReplaced.

.

+3

Source: https://habr.com/ru/post/1653256/


All Articles