谷歌浏览器扩展:popup.html javascript 与 jquery
我正在扩展 google chrome,我有一个简单的扩展程序,运行以下 popup.html 文件:
<script type = "text/javascript">
alert("hi from popup.html");
</script>
<body>
Hello World
</body>
一旦我将 src 属性和 url 添加到 google jquery CDN 'alert("hi from popup.html") ;'不再运行。
我的清单文件如下所示:
{
"name": "My First Extension",
"version": "1.0",
"description": "The first extension that I made.",
"background_page": "background.html",
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
},
"permissions": [
"tabs","http://*/*","https://*/*"
]
}
为什么添加 jquery 源会破坏弹出窗口?
I am playing around with extending google chrome and I have a simple extension running with the following popup.html file:
<script type = "text/javascript">
alert("hi from popup.html");
</script>
<body>
Hello World
</body>
As soon as I add src attribute with the url to the google jquery CDN the 'alert("hi from popup.html");' no longer runs.
My manifest file looks like:
{
"name": "My First Extension",
"version": "1.0",
"description": "The first extension that I made.",
"background_page": "background.html",
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
},
"permissions": [
"tabs","http://*/*","https://*/*"
]
}
Why does adding the jquery source break the popup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将脚本分成两个语句。试试这个:
You will need to break your scripts up into two statements. Try this: