admin管理员组文章数量:1296843
Why is my background.html page throwing this:
Uncaught SyntaxError: Unexpected token <
in line 1
Here is the actual html:
<html>
<head>
<script type="text/javascript" src="fancy-settings/source/lib/store.js"></script>
<script type="text/javascript" src="background.js"></script>
</head>
<body></body>
</html>
So chrome plains about the first opening "<" and I have no idea why.
Why is my background.html page throwing this:
Uncaught SyntaxError: Unexpected token <
in line 1
Here is the actual html:
<html>
<head>
<script type="text/javascript" src="fancy-settings/source/lib/store.js"></script>
<script type="text/javascript" src="background.js"></script>
</head>
<body></body>
</html>
So chrome plains about the first opening "<" and I have no idea why.
Share Improve this question asked Apr 25, 2012 at 12:25 KaiKai 2,3253 gold badges32 silver badges44 bronze badges 3- 6 Are you sure that the plaint is about this file and not one of the .js files? – Mr Lister Commented Apr 25, 2012 at 12:30
- Sounds like a JSON parsing error. That's at least what one would look like. Are you sure none of the JavaScripts loads/parses a file that is expected to be JSON? – Tharabas Commented Apr 25, 2012 at 12:35
-
Can you include your
manifest.json
file contents? – Mihai Parparita Commented Apr 27, 2012 at 17:11
3 Answers
Reset to default 6I had the same issue. Just replace in your manifest.json
file
"background": {
"scripts": ["background.js"]
},
with:
"background": {
"page": "background.html"
},
remove js:
<script type="text/javascript" src="fancy-settings/source/lib/store.js"></script>
<script type="text/javascript" src="background.js"></script>
If the error persists, then you are not hooked up correctly js
If you are using Manifest V3, just add type: "module" in the background
{
...
"background": {
"service_worker": "background.js",
"type": "module"
},
...
}
本文标签:
版权声明:本文标题:javascript - chrome extension background page error: "Uncaught SyntaxError: Unexpected token <" - Stack 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741643206a2390037.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论