【发布时间】:2021-08-31 14:33:51
【问题描述】:
我正在开发一个禁用退格的 chrome 扩展;它在谷歌文档中不起作用。 https://github.com/tuminzee/disable-backspace
manifest.json
"name": "Disable Backspace",
"version": "0.1",
"manifest_version": 3,
"description": "A chrome extension which disables backspace key",
"icons": {
"128" : "icon128.png",
"48" : "icon48.png",
"16" : "icon16.png"
},
"content_scripts": [
{
"matches": [
"*://*/*"
],
"js": [
"main.js"
]
}
],
"permissions": [
"input"
]
}
main.js
document.addEventListener("keydown", function(event) {
console.log(event);
if(event.which == 8 || event.keyCode == 8 || event.code == "Backspace" ){
event.preventDefault();
}
});
警告
The page delivered both an 'X-Frame-Options' header and a 'Content-Security-Policy' header with a 'frame-ancestors' directive. Although the 'X-Frame-Options' header alone would have blocked embedding, it has been ignored
如果您有任何与此相关的资源,请分享。 提前谢谢你。
【问题讨论】:
标签: google-chrome-extension google-docs content-security-policy keyevent x-frame-options