Skip to content

Instantly share code, notes, and snippets.

@RepComm
Created January 24, 2025 19:58
Show Gist options
  • Save RepComm/e547574cd336a8953613fcf5f1e22b06 to your computer and use it in GitHub Desktop.
Save RepComm/e547574cd336a8953613fcf5f1e22b06 to your computer and use it in GitHub Desktop.
goodbye_blank (removes _blank) - currently only supports bing.com, will edit in future
//content.js
function goodbye_blank() {
console.log("removing _blanks")
for (const a of document.querySelectorAll("a")) {
if (a.target == "_blank") {
a.target = "";
}
}
}
setInterval( () => {
goodbye_blank()
}, 300);
{
"name": "goodbye_blank",
"description": "_blank is bad, goodbye!",
"version": "1.0",
"manifest_version": 3,
"content_scripts": [{
"matches": ["*://*.bing.com/*", "*://bing.com/*"],
"js": ["content.js"],
"run_at": "document_start",
"all_frames": true
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment