Add "Mute Site" functionality to all websites in Google Chrome

Make the "Mute Site" button active on every site you visit in Google Chrome

  1. // ==UserScript==
  2. // @name Add "Mute Site" functionality to all websites in Google Chrome
  3. // @namespace Violentmonkey Scripts
  4. // @match *://*/*
  5. // @grant none
  6. // @version 1.0
  7. // @author enbyte
  8. // @description Make the "Mute Site" button active on every site you visit in Google Chrome
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12.  
  13. // https://www.reddit.com/r/chrome/comments/1de8ukn/right_click_tab_muteunmute_site_greyed_out/
  14. // with swears removed + comments
  15.  
  16. function toggle_audio() {
  17. let dummy_audio_element = document.createElement('audio'); // create a sound to be played
  18. dummy_audio_element.src = 'data:audio/mp3;base64,'; // make it look like an mp3, with no real data
  19. document.documentElement.appendChild(dummy_audio_element); // add then immediately delete so chrome sees a blank audio mp3 b64 being played
  20. document.documentElement.removeChild(dummy_audio_element);
  21. }
  22.  
  23. toggle_audio();