Javascript 简单的Chrome扩展赢得';t显示弹出窗口

Javascript 简单的Chrome扩展赢得';t显示弹出窗口,javascript,html,google-chrome,google-chrome-extension,Javascript,Html,Google Chrome,Google Chrome Extension,我正在做一个简单的chrome扩展,应该在弹出窗口中显示时间。我正在利用这里和那里的在线资源学习。这是我的舱单: { "manifest_version": 2, "name": "Time Machine", "version": "1.0", "description": "Get the right time, always!", "browser_action": { "default_icon": "icon19.png", "popup" :

我正在做一个简单的chrome扩展,应该在弹出窗口中显示时间。我正在利用这里和那里的在线资源学习。这是我的舱单:

{
  "manifest_version": 2,

  "name": "Time Machine",
  "version": "1.0",
  "description": "Get the right time, always!",

  "browser_action": {
    "default_icon": "icon19.png",
    "popup" : "popup.html"
  }
}  
popup.html

<!DOCTYPE HTML>
<html>
    <style>
        body, html{
            height : 100%;
        }

        body{
            display : flex;
            display : -webkit-flex;
            flex-direction : row;
            -webkit-flex-direction : row;
            justify-content : center;
            align-items : center;
        }

        .maincontent{
            width : 100%;
            display : flex;
            display : -webkit-flex;
            flex-direction : row;
            -webkit-flex-direction : row;
            justify-content : center;
            align-items : center;
        }

    </style>
    <title>Time Machine</title>
    <body>
        <div class="maincontent">
            <p id="time"></p>
        </div>
    </body>
    <script>
        var time = document.getElementById("time");
        window.onload = function(){
            time.innerHTML = Date();
        }

        setInterval(function(){ time.innerHTML = Date(); },1000);

    </script>
</html> 

正文,html{
身高:100%;
}
身体{
显示器:flex;
显示:-webkit flex;
弯曲方向:行;
-webkit柔性方向:行;
证明内容:中心;
对齐项目:居中;
}
.主要内容{
宽度:100%;
显示器:flex;
显示:-webkit flex;
弯曲方向:行;
-webkit柔性方向:行;
证明内容:中心;
对齐项目:居中;
}
时间机器

var time=document.getElementById(“时间”); window.onload=函数(){ time.innerHTML=Date(); } setInterval(函数(){time.innerHTML=Date();},1000);
但是,在加载未打包的chrome扩展后单击图标时,不会发生任何事情。我没有看到弹出窗口出了什么问题?

 "popup" : "popup.html"  
需要改成

 "default_popup" : "popup.html"

此外,您还需要将javascript移动到一个单独的文件中,并通过
标记将其包括在内。@rsanschez是的,也是:)完成了:)