顯示問題標籤 顯示所有問題

calling sidebarAction.open() from tabs.onActivated event

I want wrote extension, that will open sidebar (with bookmarks) on New Tab, and close it on other tabs. I make background script with next content: ``` browser.tabs.onAct… (閱讀更多)

I want wrote extension, that will open sidebar (with bookmarks) on New Tab, and close it on other tabs.

I make background script with next content: ``` browser.tabs.onActivated.addListener(function(tab){ if(tab.url=="about:newtab") browser.sidebarAction.open() else browser.sidebarAction.close() }) ``` And I get next error in console: `browser.sidebarAction is undefined`

Also I can see here that such actions "can only be called from inside the handler for a user action." Clicking the extension's browser action or page action.

And I want ensure whether tabs.onActivated event is a User action?

And if not, is there any ways or suggestions to go around this limitation?

FeelUs 於 9 小時前 詢問