show up in your extensions list.
<kur
...@chromium.org> wrote:
> Hi,
> I tried copying and pasting your code into a test extension and I when
> I pressed the browser action button, "from the extension" was printed in the
> current HTML page's console, and "goodbye" was printed in the background
> page's console. Keep in mind that the pages run in different contexts, so
> you'll need to open the console for each one to see both messages.
> Is it possible that your content script is not being injected properly?
> Could you share your manifest file? Which HTML pages are you testing this
> on?
> ~Arne
> On Thu, Jan 21, 2010 at 2:53 AM, Gaurang <shahgo
...@gmail.com> wrote:
>> Hi guys,
>> I am learning how to make chrome add-on and was just checking how
>> message passing thing works, but I am facing a problem in making it
>> work. I am taking the simple example from
>> http://code.google.com/chrome/extensions/messaging.html
>> page but it's not working.
>> I want to My background.html page to send a request to content.js file
>> only when someone click on the browser button. for that i have done
>> something like this
>> background.html page
>> ======================
>> <html>
>> <script>
>> function getPageandSelectedTextIndex() {
>> chrome.tabs.getSelected(null, function(tab) {
>> chrome.tabs.sendRequest(tab.id, {greeting: "hello"},
>> function
>> (response) {
>> console.log(response.farewell);
>> });
>> });
>> }
>> chrome.browserAction.onClicked.addListener(function(tab) {
>> getPageandSelectedTextIndex();
>> });
>> </script>
>> </html>
>> content.js
>> =========================================
>> chrome.extension.onRequest.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"});
>> else
>> sendResponse({}); // snub them.
>> });
>> i was thinking message will be logged in console when i will click on
>> the button. but i m not able to see any message there.
>> can anybody please tell me what's wrong going on here ??
>> Thanks in advance
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Chromium-extensions" group.
>> To post to this group, send email to chromium-extensions@googlegroups.com.
>> To unsubscribe from this group, send email to
>> chromium-extensions+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/chromium-extensions?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "Chromium-extensions" group.
> To post to this group, send email to chromium-extensions@googlegroups.com.
> To unsubscribe from this group, send email to
> chromium-extensions+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/chromium-extensions?hl=en.