about sending messages among bg.html, popup.html and contentscript.js
        Posted  
        
            by T_t
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by T_t
        
        
        
        Published on 2010-04-10T03:15:16Z
        Indexed on 
            2010/04/10
            3:23 UTC
        
        
        Read the original article
        Hit count: 445
        
Hi!:) In my extension, when a button named "mybutton1" in the popup.html is clicked, it sends a message "getvar1" to the contentscript.js, then the contentscript.js sends a message "i want var1" to the background.html to get an object named "var1".If the button named "mybutton2" is clicked, the contentscript.js gets the "var2" object. How should i do under this condition? What's more, i am a little confused about the chrome.extension.onRequest.addListener method and chrome.extension.sendRequest method.Could someone tell me the mechanism of the two methods? Thanks!
© Stack Overflow or respective owner