Skip to content

Instantly share code, notes, and snippets.

@neoOpus
Forked from thefloodshark/.js
Created October 20, 2021 09:06
Show Gist options
  • Save neoOpus/9fc9deb11b8bd8b8c377be651653e934 to your computer and use it in GitHub Desktop.
Save neoOpus/9fc9deb11b8bd8b8c377be651653e934 to your computer and use it in GitHub Desktop.
Automatic Tab Closer Based on URL Text
// ==UserScript==
// @name Autoclose URL
// @namespace Autoclose URL
// @include *
// @grant window.close
// ==/UserScript==
function check_if_should_close(url) {
if (url.match(/yourURLtexthere/))
return true;
return false;
}
if (check_if_should_close(document.location.href)) {
var win = window.open('your current page URL', '_self', '');
window.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment