You'll need to add a listener for chrome.tabs.onUpdated as well. The tab will initially be created with a null url, but then you'll get update events with the real url.
On Sat, Dec 5, 2009 at 10:30 PM, Jiaqin <[email protected]> wrote: > Hi all, > > I'm new to the Chrome extensions, and I'm thinking of such an > extension, which will detect every link clicked by the user, and if > meeting a specific url, the extension will do some work, otherwise, it > does nothing. > > I use the code like this, suppose every link is opened in a new tab: > > chrome.tabs.onCreated.addListener(function(tab) { > alert(tab.url); > }); > > However, I have a problem when I click to open a url that is not > available ( actually is blocked by my network provider ). In this > case, I just got a url of null. > > Is there any way for me to get the real url? I need this because my > extension is just being designed to deal with this unavailable-url > condition... > > Thank you! > > -- > > 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.
