green84z
green84z

Reputation: 11

Chrome extension: "Uncaught Error: "getBackgroundPage" can only be used in extension processes...."

I published a chrome extension to testers only. The app seems to work very well. I don't see any errors when inspecting the console for the popup or the background page. However, I get the following error when inspecting the console for any web page: "Uncaught Error: "getBackgroundPage" can only be used in extension processes. See the content scripts documentation for more extensions/schema_generated_bindings.js:418"

This app contains several JavaScript files, but each one includes the code within a self executing function. The "getBackgroundPage" calls are in the JavaScript files.

Could you please help? Isn't the app I built an isolated module independent from any web page? How can I prevent this error from happening?

Upvotes: 1

Views: 1188

Answers (1)

Trunal Bhanse
Trunal Bhanse

Reputation: 1691

I had the same error when I was trying to communicate with the background page from my content script. The correct way of doing it is via Message Passing. It is very well documented here : https://developer.chrome.com/extensions/messaging.html

Upvotes: 1

Related Questions