3
我正在做一个简单的Chrome扩展,应该在弹出窗口中显示我的时间。我在这里和那里使用在线资源进行学习。这里是我的清单:简单的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>
然而,点击加载解压的Chrome扩展程序图标后,没有任何反应。我没有看到弹出窗口。 什么问题?需要
此外,您需要将您的javascript移动到一个单独的文件,并通过'