Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

calling sidebarAction.open() from tabs.onActivated event

  • No replies
  • 1 has this problem
  • 14 views
more options

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?

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 [https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/User_actions 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?