Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
how can i sendMessage from background.js to devtools.panel's page
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
zhengxin...@gmail.com  
View profile  
 More options Sep 23 2012, 5:36 am
From: zhengxin...@gmail.com
Date: Sun, 23 Sep 2012 02:36:37 -0700 (PDT)
Local: Sun, Sep 23 2012 5:36 am
Subject: how can i sendMessage from background.js to devtools.panel's page

in my extension , which have :

{
   "manifest_version" : 2,
  .....
   "background":{
    "scripts":["background.js"]
   },
  "devtools_page": "devtools.html"
  .....

}

in background.js
==================
chrome.webRequest.onBeforeRequest.addListener(function(req){
    chrome.extension.sendMessage({test:123});
});

==================

in devtools.html
==================
chrome.extension.onMessage.addListener(function(Detail){

});

==================

in chrome21 ,  devtools.html page can’t receive the message from
background.js
and background.js get an error message : {"message":"Could not establish
connection. Receiving end does not exist."}

is anything wrong here?


 
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.
Andrey Kosyakov  
View profile  
 More options Sep 26 2012, 10:50 am
From: Andrey Kosyakov <ca...@chromium.org>
Date: Wed, 26 Sep 2012 18:50:31 +0400
Local: Wed, Sep 26 2012 10:50 am
Subject: Re: [Chrome DevTools] how can i sendMessage from background.js to devtools.panel's page

On Sun, Sep 23, 2012 at 1:36 PM, <zhengxin...@gmail.com> wrote:

in background.js

> ==================
> chrome.webRequest.onBeforeRequest.addListener(function(req){
>     chrome.extension.sendMessage({test:123});
> });

[...]

in chrome21 ,  devtools.html page can’t receive the message from

> background.js
> and background.js get an error message : {"message":"Could not establish
> connection. Receiving end does not exist."}

> is anything wrong here?

You can't use chrome.extension.sendMessage() to send a message to an
extension page running in the context of DevTools (this call is for sending
to listeners running in the extension process, i.e. background page,
options page etc). The best way to communicate from background page to
DevTools is to open a port from the DevTools page using
chrome.extension.connect (and a chrome.extension.onConnect listener in the
background page) and use port.postMessage() in the background page later.

Best regards,
Andrey.


 
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.
End of messages
« Back to Discussions « Newer topic     Older topic »