Chrome extension - Message Passing

Posted by Felipe Barreiros on Stack Overflow See other posts from Stack Overflow or by Felipe Barreiros
Published on 2010-06-08T15:27:38Z Indexed on 2010/06/08 16:32 UTC
Read the original article Hit count: 185

Hey there.

I'm trying to get the info that is set on the Options Page to alter the behavior of my extension.

Basically, if a checkbox on OptionsPage is set to true, the extension runs, otherwise it doesn't. I'm returning true on the background.html for testing purposes, but still, it doesn't work.

Would you guys help me out? Thanks!

Code being injected to the page:

if(chrome.extension.sendRequest() == 'true')
    alert("checkbox set to true");
else
    alert("it is disabled");

background.html

<script>
chrome.extension.onRequest.addListener(function(){
    return true;
    }
</script>

© Stack Overflow or respective owner

Related posts about google-chrome

Related posts about google-chrome-extension