I dont see any evidence of the contest script running at all. i cant
figure out why. I've set my content script to just:
window.open("foo")
window.alert("foo")
console.log('foo')
and none of those things get called. is this a permission thing or
some configuration thing?
this is my manifest.json:
{ "name": "Quote"
, "version": "1.0"
, "description": "Quote the selected text."
, "toolstrips": [ "quote.html" ]
, "content_scripts" : [ { "js" : [ "quote.js"]
, "matches" : ["http://*/*", "https://*/*"]
}]
, "permissions": [ "tabs"
, "http://*/*"
, "https://*/*"
]
}
On Tue, Sep 15, 2009 at 10:10 PM, <--v1c1ous--> <[email protected]> wrote:
>
> You can connect contentScript with the extension onLoad, onEvent or
> whatever you want, also you can send the tab.id as parameter to the
> ToolStrip to identify where is the contentScript.
>
> See this example:
>
> //$contentScript.js
>
> port = chrome.extension.connect({name: 'portname'});
> port.onMessage.addListener(onMessageRecieved);
> port.postMessage({message: "givemesomething"});
>
> function onMessageRecieved(data) {
> if (data.message == "something") {
> console.log("Toolstrip Say: "+data.something);
> }
> }
>
> //$ToolStrip.html
>
> var myport;
> chrome.extension.onConnect.addListener(onPortConnect);
>
> function onPortConnect(port) {
> if(port.name != 'portname') return false;
> myport = port;
> port.onMessage.addListener(onMessageRecieved);
> }
>
> function onMessageRecieved(data) {
> if (data.message == "givemesomething") {
> console.log("contentScript Say: "+data.message);
> myport.postMessage({message: "something", something: "Now you
> have
> something from ToolStrip"});
> }
> }
>
>
> -v1c1ous
>
> On Sep 15, 7:48 pm, Anatoly Yakovenko <[email protected]> wrote:
>> so if i add the tabs permissions to my extension i am able to post
>> messages, but i am not receiving them in my content script. anyone
>> have any idea on what i need to do togetmy content script to
>> "receive" messages.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Chromium-extensions" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---