#Build Chrome Extention - get current tab methods

2 messages · Page 1 of 1 (latest)

unkempt dragon
#

in the guide Per goes over using chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { }) to get the current tab but google is actually recommending window.location.href;
What is the advantage of using the more complicated method?

rough berry
#

I'm thinking that the latter only works in the context of one page in the browser, but the former is in the context of the entire browser? Intuitively, the scope that a browser plug-in exists in is the whole browser, so a window variable wouldn't have meaning.