Answer the question
In order to leave comments, you need to log in
Firefox passing a message from a page to a plugin. "ReferenceError: browser is not defined"?
Wrote a website plugin. Everything works fine on chrome, but in Firefox it can't find the browser component.
I'm trying to get the message from the page from background.js like this:
function doSomethind(){
//много кода также с использованием browser (ошибок нет, все работает)
}
browser.runtime.onMessageExternal.addListener(
function(request, sender, sendResponse) {
if (request.screenshot){
doSomething();
console.log ('success');
}
});
$('#saveImage').click(function(){
browser.runtime.sendMessage(
{screenshot: {
'user_id': 123,
'project_id': 123
}},
function(response) {});
});
ReferenceError: browser is not defined
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question