Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.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
Google chrome extension 如何访问chrome-search://local-ntp/local-ntp.html 通过我的html中的a href_Google Chrome Extension - Fatal编程技术网

Google chrome extension 如何访问chrome-search://local-ntp/local-ntp.html 通过我的html中的a href

Google chrome extension 如何访问chrome-search://local-ntp/local-ntp.html 通过我的html中的a href,google-chrome-extension,Google Chrome Extension,我正在开发一个chrome扩展,它需要chrome\u url\u覆盖新选项卡。 html应该包含一个chrome的链接-search://local-ntp/local-ntp.html. 我在newtab.html中用chromeTab尝试了一下,但当我点击链接时,它没有响应 manifest.json { "manifest_version": 2, "name": "My First Extention", "version": "1.0", "description": "My

我正在开发一个chrome扩展,它需要chrome\u url\u覆盖新选项卡。 html应该包含一个chrome的链接-search://local-ntp/local-ntp.html. 我在newtab.html中用chromeTab尝试了一下,但当我点击链接时,它没有响应

manifest.json

{
"manifest_version": 2,
"name": "My First Extention",
 "version": "1.0",
 "description": "My new extention",
 "browser_action": {
"default_icon": "logo.png"
 },
 "chrome_url_overrides": {
  "newtab": "newtab.html"
},

 "permissions": [
   "activeTab"
 ]
 }
newtab.html

<!DOCTYPE html>
<html>
    <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>My Extension</title>
     <!-- Bootstrap -->
     <!-- Latest compiled and minified CSS -->
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <!-- jQuery library -->
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
     <!-- Latest compiled JavaScript -->
     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>    
     </head>
     <body>
      <a href="chrome-search://local-ntp/local-ntp.html"> Chrome Tab</a>

       </body>
  </html>

我的分机

将单击侦听器添加到该链接元素,并在侦听器中使用chrome.tabs.update导航到该URL,或使用chrome.tabs.create创建新选项卡。