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 window.history.back();不在Chrome扩展中工作_Javascript_Google Chrome_Google Chrome Extension - Fatal编程技术网

Javascript window.history.back();不在Chrome扩展中工作

Javascript window.history.back();不在Chrome扩展中工作,javascript,google-chrome,google-chrome-extension,Javascript,Google Chrome,Google Chrome Extension,我正在创建一个GoogleChrome扩展,它在一个新选项卡中打开上一页,但使用我当前的代码,它只是执行并创建一个新的空白选项卡。我怎样才能使“历史回顾”按钮起作用 显示 { "manifest_version": 2, "name": "Back", "description": "Opens the Previous Page in a New Tab", "version": "1.0", "background": { "scripts": ["popup.js"]

我正在创建一个GoogleChrome扩展,它在一个新选项卡中打开上一页,但使用我当前的代码,它只是执行并创建一个新的空白选项卡。我怎样才能使“历史回顾”按钮起作用

显示

{
 "manifest_version": 2,

 "name": "Back",
 "description": "Opens the Previous Page in a New Tab",
 "version": "1.0",
 "background": { 
 "scripts": ["popup.js"] 
 },

 "browser_action": {
 "default_icon": "icon.png",
 "default_title": "Back"
 },

 "permissions": [
 "tabs",
 "history"

 ]
}
和Popup.js

  // Called when the user clicks on the browser action.
  chrome.browserAction.onClicked.addListener(function(tab) {
  var action = window.history.back(1);
  chrome.tabs.create({ url: action });
  });

window.history.back(1)是一个函数,如果我是正确的,它不会返回URL。这会使你的url为空吗?这是有道理的,但我如何将它合并到一个可用的url中呢?