How do you get the current tab in a popup window created with chrome.windows.create

Viewed 9

Let's say I was on example.com, and an extension popup uses chrome.windows.create to open logs.html. Inside logs.html, it links to logs.js, and in logs.js I want to access example.com's URL and id using chrome.tabs.query. I tried doing this:

var query = { active: true, currentWindow: true };

function callback(tabs) {
  var currentTab = tabs[0];
  console.log("Logging for " + currentTab.url)
}

chrome.tabs.query(query, callback);

But it returns chrome-extension://id/logs.html. So how do I access example.com in the window?

0 Answers
Related