18

I don't mind the advertisements on the right side or the small banner inside YouTube videos, but the advertisements shown before a video is played are really annoying.

How can I disable those advertisements?

I know I can install Adblock Plus for Firefox, but that also disables all other advertisements which is not fair for webmasters. If that's the only way to get rid of the advertisements, Google seriously did something wrong.

1
  • Have you tried the add-ons from How To Block Youtube Ads? I used that site for Firefox and for Chrome, worked perfectly.
    – Pio89
    Sep 13, 2013 at 17:52

3 Answers 3

9

Based on the extension as posted by @phwd, I've created a simple script that is designed to do exactly one thing: remove in-video advertisements.

Simple installation instructions for Firefox

  1. Go to https://addons.mozilla.org/firefox/addon/greasemonkey/ and press the green installation button
  2. After installation of the add-on, restart Firefox
  3. Open http://lekensteyn.nl/files/Remove_in-video_Youtube_adverts.user.js and press the Install button.
  4. Profit!

Other browsers

Instructions for installing this script across various browsers can be found on https://stackapps.com/tags/script/info

Firefox with Noscript

If you're using Firefox and have NoScript installed, you can use the below surrogates. You have to add two settings to about:config, both of type string.

  1. Key: noscript.surrogate.removeVideoAdsYoutube.sources
    Value:

    !@*.youtube.com

  2. Key: noscript.surrogate.removeVideoAdsYoutube.replacement
    Value:

    (function(){try{var o=ytplayer.config.args,i;for(i in o){if(o.hasOwnProperty(i)&&/^(afv_)?ad/.test(i))delete o[i]}}catch(e){}var a=document.getElementById("movie_player");if(a){var b=a.cloneNode(!0); b.setAttribute("flashvars", a.getAttribute("flashvars").replace(/&(afv_)?ad[^&]+/g,"")); a.parentNode.replaceChild(b,a)}})()

If you want to make your own surrogates, have a look at http://hackademix.net/2011/09/29/script-surrogates-quick-reference/

UPDATE (02/24/14): fixed noscript surrogate code. Greasemonkey script still broken at this date.

4
  • 1
    FYI: this broke at some version, the ads appeared back a month ago or so.
    – Lekensteyn
    May 9, 2013 at 10:08
  • 1
    For me, since I used your script, I never saw ads, even now Aug 6, 2013 at 1:34
  • 1
    @Theta30 Are you using other extensions or userscripts that may do that?
    – Lekensteyn
    Aug 6, 2013 at 8:40
  • Note: I have looked at fixing the userscript, but an issue remains: when navigating to a new video, the ads are still visible. Attempts to fix that (overwriting a getter/setter on ytplayer) introduced other sources of bugs.
    – Lekensteyn
    Mar 3, 2014 at 17:30
5

You can use Youtube options for Google Chrome, under video options in the settings enable "Hide in-video ads and annotations"

Hide the in-video ads

3
  • Do you know a similar tool for Firefox? Also, does the option "Hide in-video ads and annotations" affect ads played before videos?
    – Lekensteyn
    Feb 9, 2012 at 15:51
  • @Lekensteyn Yes that's what the option means; removes ads before videos. No I don't know a similar tool for Firefox. The author used to have a Firefox extension but they removed it. spoi.com/software/yto
    – phwd
    Feb 9, 2012 at 16:08
  • Thanks for your pointer, I've created a small script that does exactly what I want without bells and whistles. webapps.stackexchange.com/a/23745/11016
    – Lekensteyn
    Feb 9, 2012 at 16:53
0

One solution is to pay for YouTube Premium that removes all YouTube ads (including video) and gives you access to original shows and also Google play music.

Not the answer you're looking for? Browse other questions tagged or ask your own question.