Kill popup window

Close all popup window automatic

As of 2021-07-29. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Kill popup window
// @namespace    https://greasyfork.org/en/scripts/408032-close-all-popup-window/
// @version      0.5
// @description  Close all popup window automatic
// @author       TechComet
// @include http://*/*
// @include https://*/*
// @supportURL   https://greasyfork.org/en/scripts/408032-close-all-popup-window/feedback
// @grant        none
// ==/UserScript==

// replace all `no_close` to custom any string


(function() {
    'use strict';

    var element_url = document.getElementsByTagName("a"), index_url;

    for (index_url = element_url.length - 1; index_url >= 0; index_url--) {
        var cur_url = element_url[index_url]
        var prefix = function (url) { return cur_url.href.indexOf(url) != -1 };

        cur_url.href = cur_url.href + "#no_close"

    }



    var except = [
        'google.com', 'facebook.com' //example except WebSites
    ]

    var hostname = window.location.hostname.replace("www.", "")

    if (window.location.href.indexOf("#no_close") == -1) {
    if (except.indexOf(hostname) == -1) {
        window.close();
    }
    }
    
})();