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","ht开发者_开发百科tp://*/*","https://*/*"
]
}
Why does adding the jquery source break the popup?
You will need to break your scripts up into two statements. Try this:
<script type="text/javascript" src="jQuery.js"></script>
<script type="text/javascript">
alert("hi from popup.html");
</script>
精彩评论