From: CGS <cgsmcml...@gmail.com>
Date: Sat, 28 Jul 2012 00:21:24 +0200
Local: Fri, Jul 27 2012 6:21 pm
Subject: Re: content script question
I was trying to see where I went wrong with my messaging part, so, I
manifest.js
}
background.html
============ <!doctype html> <html> <body> <script src="extension_contentscript.js" type="text/javascript"></script> </body> </html> page_contentscript.js
});
extension_contentscript.js
=================== chrome.extension.onMessage.addListener( function(request, sender, sendResponse) { console.log(sender.tab ? "from a content script:" + sender.tab.url : "from the extension"); if (request.greeting == "hello") sendResponse({farewell: "goodbye"}); }); I loaded the extension and I checked the console:
Uncaught TypeError: Cannot call method 'addListener' of undefined
exactly at the line: chrome.extension.onMessage.addListener
More than that. I started index.html on 127.0.0.1 and I got:
Uncaught TypeError: Object #<Object> has no method 'sendMessage'
at the line: chrome.extension.sendMessage
As you can see, it's nothing else but copy-paste from
I am using Chromium 18.0.1025.168 (Developer Build 134367 Linux) Ubuntu
Regards,
On Fri, Jul 27, 2012 at 4:30 PM, CGS <cgsmcml...@gmail.com> wrote:
> Hi everyone, > I am trying to do some messages parsing in between the extension popup and
> Uncaught TypeError: Cannot call method 'addListener' of undefined
> The manifest permissions:
> "permissions": [
> The popup is loading a javascript file in which a function calls (one
> chrome.extension.onMessage.addListener(
> Am I missing anything?
> CGS
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||