On Wed, Nov 11, 2009 at 1:18 PM, Bartek <bart.ci
...@gmail.com> wrote:
> Hi there,
> I'm playing with Browser actions right now and have a popup.html file
> which contains 2 elements:
> - One is a button that will popup a new window using the regular
> window.open command from Javascript.
> - The second is a list of recent entries that my extension will fetch
> from the service it's for.
> My biggest issue right now is not fully understanding how background
> pages work with the front end of an extension. I've read the
> documentation and only half-understand the message passing that is to
> be done.
> Right now I have code like so in my popup.html file:
> $(document).ready(function() {
> $("#pin").click(function() {
> var q;
> var port = chrome.extension.connect({"name":
> "random_test_arg"});
> window.open(....);
> });
> });
> I understand I need to send a message to my background process to
> collect information I want, but how do I get this back and what's the
> right way to catch/send the info? In background.html I see this works:
> chrome.extension.onConnect.addListener(function(port) {
> var q;
> chrome.tabs.getSelected(null, function(tab) {
> console.log(tab);
> q = tab.url;
> });
> });
> And I get the correct tab object, with a url, but I have no clue how
> to send it back to my front-end function so I can open the window with
> the variables I get in my backend.
> Hopefully my question makes sense. I'm very close to getting it, but I
> just want to verify I'm on the right track here! :)
> --
> 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<chromium-extensions%2Bunsu bscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/chromium-extensions?hl=.