Nucktrooper
Nucktrooper

Reputation: 245

Microsoft Edge popup extension how to get backgroundpage?

I am trying to use my Chrome extension on Microsoft Edge to adapt it, but I can't build the popup because in the script of my popup, some variables seem to not exist:

var bg = chrome.extension.getBackgroundPage();

This line isn't working, it supposed to access data of content scripts. I've found some guys saying browser.extension.getBackgroundPage() must be used to replace it, but it doesn't work to.

By what should I replace this line?

Upvotes: 2

Views: 2252

Answers (2)

Atif Hussain
Atif Hussain

Reputation: 898

There is a software named "Tool kit" provided by Microsoft to convert your existing chrome extension to Microsoft extension by bridging the Chrome APIs. This tool help to remove errors from the convertible version and also highlights the syntax error which not allowed in edge extension.

Upvotes: 2

Haibara Ai
Haibara Ai

Reputation: 10897

  1. Since Microsoft Edge uses browser.* namespace, you should use browser.extension.getBackgroundPage() instead.

  2. For debugging background script and content script, see Debugging extensions for more details

  3. For debugging popup scripts, it seems there is no visible entry. One workaround would be manually opening that page in Microsoft Edge via typing the popup url, something like ms-browser-extension://[Extension_Id]/html/popup.html

Upvotes: 4

Related Questions