🏠 Home 

Greasy Fork is available in English.

Disable Notifications API

Disable Notifications API where sites may show popup notifications message at bottom-right of the web browser. Any sites which require Notifications API may cause the web browser to ask user for a permission to display notifications. This script disables both the notifications and the permission prompt. It is intended for users who find them annoying.


安装此脚本?
  1. // ==UserScript==
  2. // @name Disable Notifications API
  3. // @namespace https://greasyfork.org/en/users/85671-jcunews
  4. // @version 1.0.1
  5. // @license GNU AGPLv3
  6. // @description Disable Notifications API where sites may show popup notifications message at bottom-right of the web browser. Any sites which require Notifications API may cause the web browser to ask user for a permission to display notifications. This script disables both the notifications and the permission prompt. It is intended for users who find them annoying.
  7. // @author jcunews
  8. // @match *://*/*
  9. // @grant none
  10. // @run-at document-start
  11. // ==/UserScript==
  12. (function() {
  13. window.Notification = {
  14. get permission() {
  15. return "denied";
  16. },
  17. set permission(a) {
  18. return "denied";
  19. },
  20. requestPermission: function(fn) {
  21. if ("function" === typeof fn) {
  22. fn("denied");
  23. return;
  24. } else {
  25. return {
  26. then: function(fn) {
  27. fn("denied");
  28. return this;
  29. }
  30. };
  31. }
  32. }
  33. };
  34. })();