Skip to content

Instantly share code, notes, and snippets.

@mouseos
Created January 3, 2024 02:29
Show Gist options
  • Save mouseos/f380fe0a4d062aeac97505ae6b14b426 to your computer and use it in GitHub Desktop.
Save mouseos/f380fe0a4d062aeac97505ae6b14b426 to your computer and use it in GitHub Desktop.
chrome 拡張 manifest v3 でレスポンスヘッダーを書き換える。この場合twitter.comのiframe表示を許可している
{
"manifest_version": 3,
"name": "Twitterスパム通報",
"version": "1.0",
"permissions": [
"browsingData",
"declarativeNetRequest"
],
"description": "スパム自動通報Chrome拡張",
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": [
"https://twitter.com/*"
],
"js": [
"content.js"
],
"run_at": "document_end"
}
],
"host_permissions": ["*://*.twitter.com/"],
"icons": {
"16": "icon/icon16.png",
"32": "icon/icon32.png",
"48": "icon/icon48.png",
"128": "icon/icon128.png"
},
"author": "Yuu (@mouse_soft_y)",
"declarative_net_request": {
"rule_resources": [
{
"id": "ruleset_1",
"enabled": true,
"path": "rules.json"
}
]
}
}
[
{
"id": 1,
"priority": 1,
"action": {
"type": "modifyHeaders",
"responseHeaders": [{ "header": "X-Frame-Options", "operation": "remove" }]
},
"condition": { "resourceTypes": ["main_frame", "sub_frame"] }
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment