Thanks for replying Matt ..

In manifest.json i specified like below

"matches": ["http://*/*";, "https://*/*";],
      "js": ["content/content.js"],
      "run_at":"document_end"

In content.js

chrome.extension.onRequest.addListener(
  function(request, sender, sendResponse) {
                 switch(request.data)
                  {

                   case "write":
                                      javascript:function sptload()
                                     {
                                                 var url =
document.createElement("script");
                                                  url.src = "http://
example.com/test.js";
 
document.getElementsByTagName('head')[0].appendChild(url);
                                     }
                                    if(typeof
window.funObj=="undefined")
                                     {
                                                           void(sptload())
                                        }else
                                      {
        
funObj.doSomething();
                                       };
                              sendResponse({});
                                break;
}

in background.js

chrome.tabs.getSelected(null, function(tab)
         {

             chrome.tabs.sendRequest(tab.id, {data:"write"}, function
(response)
             {
                        console.log("createText :");
             });
         });

In test.js which resides on my website will create div on the web page
extension is clicked and create a funObj class,  doSomething() is a
function in it.For the first time it will append the script for the
second time it will check and wont append but here if i access
window.funObj it is always giving me undefined.Is there any bug if i
append a javascript object and try to access through window.funObj


Correct me if i am wrong as i haven't specified anything in the
content script regarding all_frames it must not load in all frames.

Your help is greatly appreciated.






On Dec 2, 12:23 am, Matt Perry <[email protected]> wrote:
> [resending from right address]
>
> Content scripts are injected into every frame of a page. When you call
> tabs.sendRequest, the onRequest event will be fired in every frame. Could
> that be what you're seeing?
>
> If not, could you post some sample code that demonstrates the problem?
>
> On Tue, Dec 1, 2009 at 10:55 AM, tangore <[email protected]> wrote:
> > I am using chrome.tabs.sendRequest in my backgroung page to contact
> > the content script the listner method is getting multiple
> > requests.Please let me know how to stop this
>
> > 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 [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<chromium-extensions%[email protected]>
> > .
> > 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 [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.


Reply via email to