google chrome扩展中包含的javascript文件的当前URL

google chrome扩展中包含的javascript文件的当前URL,javascript,google-chrome,google-chrome-extension,Javascript,Google Chrome,Google Chrome Extension,“我的扩展”显示我访问特定网站(youtube.com、quora.com)的次数,保存在本地存储中,并在打开新选项卡时显示。扩展的结构如下所示: index.html manifest.json script.js manifest.json { "manifest_version": 2, "name": "Getting started example", "description": "", "version": "1.0",

“我的扩展”显示我访问特定网站(youtube.com、quora.com)的次数,保存在本地存储中,并在打开新选项卡时显示。扩展的结构如下所示:

  • index.html
  • manifest.json
  • script.js
manifest.json

    {
      "manifest_version": 2,

      "name": "Getting started example",
      "description": "",
      "version": "1.0",
      "chrome_url_overrides" : {
        "newtab": "index.html"
      }
    }

index.html包括script.js。我的问题是如何跟踪访问过的url列表。我需要在script.js中使用背景页面还是当前url可以使用chrome API?

可能重复的@Gothdo我可以在script.js中使用
chrome.tabs.query
,还是需要在背景页面中使用它。