我尝试使用 React js 开发我的第一个 Chrome 扩展。当我尝试使用 chrome.webRequest API 阻止 chrome 扩展中的 URL 时,错误页面显示两个错误。
“webRequestBlocking”需要 2 或更低的清单版本。
未选中的runtime.lastError:您无权使用阻塞的webRequest侦听器。请务必在清单中声明 webRequestBlocking 权限。
我在清单文件中声明了“webRequestBlocking”权限。这是我的manifest.json
{
"manifest_version": 3,
"name": "Chrome Extension",
"description": "First Extension",
"options_page": "options.html",
"background": {
"service_worker": "background.bundle.js",
"matches": [
"<all_urls>"
]
},
"action": {
"default_title": "Open Extension",
"default_icon": "icon-34.png"
},
"icons": {
"128": "icon-128.png"
},
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*",
"<all_urls>"
],
"js": [
"contentScript.bundle.js"
],
"css": [
"content.styles.css"
]
}
],
"devtools_page": "devtools.html",
"web_accessible_resources": [
{
"resources": [
"content.styles.css", …Run Code Online (Sandbox Code Playgroud) Whatsapp-web js 不会\xe2\x80\x99t 触发就绪事件和其他仅触发 Qr 事件。我还正确扫描并验证了 Whatsapp。但没有准备好事件。
\nconst { Client } = require('whatsapp-web.js');\nvar qrcode = require('qrcode-terminal');\nconst client = new Client();\n\nclient.on('qr', (qr) => {\nqrcode.generate(qr, { small: true });\nconsole.log('QR RECEIVED');\n});\n\nclient.on('ready', () => {\nconsole.log('Client is ready!');\n});\n\nclient.initialize();\nRun Code Online (Sandbox Code Playgroud)\n