[chrome扩展] Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist

chrome插件编写时遇到错误

Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.

查询了多个错误  后续解决 错误原因归纳如下

1 当前页面并不是可用网页页面  如打开的是扩展程序页面  或者 新建标签页面

2 manifest.json  中  "content_scripts":  命名冲突? 之前一直命名content-scripts.js 一直报错 后续成功

"content_scripts": 
	[
		{
			//"matches": ["http://*/*", "https://*/*"],
			// "<all_urls>" 表示匹配所有地址
			// "matches": ["https://www.91160.com/dep/show/depid-3445.html"],
			"matches": ["<all_urls>"],

			// 多个JS按顺序注入
			// 文件名为 content_scripts 一直提示错误  修改text后正常
			"js": ["js/text.js"]
		}
	],

 

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值