Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 获取调用注入脚本的选项卡的url_Javascript_Google Chrome_Google Chrome Extension - Fatal编程技术网

Javascript 获取调用注入脚本的选项卡的url

Javascript 获取调用注入脚本的选项卡的url,javascript,google-chrome,google-chrome-extension,Javascript,Google Chrome,Google Chrome Extension,有个问题。 我想获取名为inject script content.js的选项卡的url: My manifest.json: My content.js: 链接的结果http://ya.ru: 但我需要看看这个 http://ya.ru/ http://ya.ru/ http://ya.ru/ 尝试window.top.document.location.href尝试window.top.document.location.href document.addEventList

有个问题。
我想获取名为inject script content.js的选项卡的url:

My manifest.json:

My content.js:

链接的结果http://ya.ru:

但我需要看看这个

http://ya.ru/  
http://ya.ru/  
http://ya.ru/  

尝试
window.top.document.location.href
尝试
window.top.document.location.href

document.addEventListener("beforeload", function(event) {
  console.log(document.location.href);
}, true);  
http://ya.ru/  
http://kiks.yandex.ru/system/fc06.html  
http://suggest.yandex.ru/jquery-1-4-2.crossframeajax.html   
http://ya.ru/  
http://ya.ru/  
http://ya.ru/