Kilian Valkhof

Front-end & user experience developer, Jedi.

Annoying.js: How to be an asshole

Javascript, 23 May 2011, 2 minute read

In January I came across a website that had a whole slew of JavaScript that attempted to prevent you from selecting text, right clicking or dragging any content onto your desktop. I decided to copy the JavaScript and create a library with examples of JavaScript techniques you can use if you want to scare your visitors away, or want to piss them off. Annoying.js is the result.


The file itself is commented with “functionality”, so I won’t bother repeating it here. You can invoke different functions via the Annoying object: Annoying.noSelect(); will disable text selection, Annoying.noRightClick(); will disable the context menu, and Annoying.kitchensink(); Will turn all the functionality on. But you’re not going to use it anyway, right? ;)

JavaScript is evil!

As you can see, you can do some pretty bad things with JavaScript that will certainly drive your visitors away (or insane!). So why is this kind of functionality available? Some functions is actually very useful if you’re writing complex “html5” web applications. By disabling text-selection on interface elements you can make the application easier to use, and you can re-implement the right click menu using your own options.

Breaking out of iframes is something I think more websites should implement, actually, if only to prevent the “OMG!!!! Look What this Kid did to his School after being Expelled! ” scams that all of my friends on Facebook keep falling for.

Using JavaScript to resize someone’s browser without consent should be reason enough to revoke someone’s license to making websites, though.

Let me know if you have any horrible additions!

Thanks for Reading!

I am Kilian Valkhof, a front-end and user experience developer from the Netherlands.
Contact me or ping me on twitter.

  1. Alice

    How about adding badly rendered dropcaps at the start of every paragraph (not just at the start of every article)?

  2. rosko

    How about cursor:none on body tag :D

  3. […] annoying.js – sooo nice and evil idea […]

  4. Nicholas


    Disabling copying text offers exactly zero protection against unauthorised copy of copyrighted material. Your browser had to download that material to display it to the user in the first place. Wouldn’t you assume that fetching the page with ANY web client or simply disabling Javascript on a browser would suffice to copy that material? DUH!!!

    You should not be building sites. You don’t even understand the very basic concepts of the web.

    And then we wonder why we see so many ugly, broken, annoying sites all over the place…

  5. Matt

    Rob – opening links in new windows is a major accessibility no-no. It can seriously screw up screen readers and it confuses the hell out of some users.

  6. […] Vi um post bem legal e resolvi traduzir para vocês. Fala sobre técnicas JavaScript para bloquear a copia de textos, redimensionar janelas, enfim, tudo que você possa fazer para irritar seus visitantes ! (fonte) […]

  7. […] Vi um post bem legal e resolvi traduzir para vocês. Fala sobre técnicas JavaScript para bloquear a copia de textos, redimensionar janelas, enfim, tudo que você possa fazer para irritar seus visitantes ! (fonte) […]

  8. Found this on a solution provided by the “leader in SaaS solutions for the hospitality industry”, needs to find a home in annoying.js:


  9. […] techniques you can use if you want to scare your visitors away, or want to piss them off. Annoying.js is the […]

  10. […] techniques you can use if you want to scare your visitors away, or want to piss them off. Annoying.js is the […]

  11. YMMD :)

  12. bindEvil!

  13. Caroline

    I am not sure I understand the syntax used to create the object. Testing a small subset of the code yields ‘TypeError: Cannot set property ‘fullScreen’ of undefined’ in Chrome.
    //code below//
    var Annoying;

    (function(a) { /** * Resize the window to fullscreen (1024×768 always) */ a.fullScreen = function ()
    { window.resizeTo(1024,768); };


  14. […] Qui trovate Annoying.js. […]

  15. […] Annoying.js: How to be an… Annoying.js – This is some crazy javascript that can really tick off your users. (tags: javascript jquery) This was written by delicious. Posted on Thursday, August 4, 2011, at 7:03 am. Filed under Uncategorized. Bookmark the permalink. Follow comments here with the RSS feed. Post a comment or leave a trackback. […]

  16. Hahah, very good indeed. Anyone with a half a clue can get round these prevention measures but guess most people don’t have half a clue. nice work though!

  17. You’re crazy! Some people will think: “That’s great, just what I needed!”. It’s like leaving a loaded gun on a school yard.

  18. RC

    I would add preventing any keyboard event and trying automatically to add to favourites

  19. Doug Maenpaa

    How about when you visit a website, and immediately the screen gets greyed out, and something else pops up in your face, requesting a response.

    I usually exit immediately , never to go back, but occasionally I turn off Java, and go back……the tacky anoyance is now gone.

    You gotta wonder where web designers learn that this is OK.

  20. […] Visit this link […]

  21. […] Annoying.Js: How To Be An Asshole What the Hex? […]

  22. Wow! Its awesome!

    This script just describe a government functionality.

    So now i need to switch off the “javascript of government” any ideas?

    Matrix is own all of us… so sad

  23. WW

    A quick necro-reply to Rob, for anyone who still doesn’t get it:

    Disabling right-click does not stop anyone from doing whatever they feel like with your copyrighted content. THEY ALREADY HAVE IT. It’s on their screen looking at them. Let me think of the ways I could copy, let’s say, a picture from a page:

    1. Turn off JavaScript, reload
    2. Get it from Page Info
    3. Find the name/URL in the page source
    4. Snag it out of my browser cache
    5. Take a screenshot and cut it out of that
    6. If all else fails, line up my camera and take a photo!

    Disabling right-click prevents exactly none of these. And anyone who really wants to jack your content is going to be using them routinely, probably 1 or 2. It annoys the good guys and does jack-all to stop the bad guys. This is not rocket science.

    So, what does it actually do? Well, that ties in to the part about forcing pages to open in a new window. There are times when I want a page to open in a new tab, generally in the background. I might want to open several different news stories, for instance, so I can just go from one to the other, especially if some of them are in those annoying “you may also be interested in…” blocks that change from reload to reload, so if you open one of those stories in the same window, the others will have changed when you get back. Now, if I’m being a slacker (that is, I don’t want to actually move my left hand to the keyboard so I can control-click on the link) I’ll right-click and pick “open in new tab” from the right-click menu. Except, of course, if some wanker has disabled that right-click menu. If they have, I have to turn off JavaScript, reload the page, and THEN open up my links as needed. And I’m not happy with the person who made me do that, especially because they did it for utterly spurious reasons.

    One basic rule of website design is that things should work like users expect them to. Or, as Jakob Nielsen put it, your users spend most of their time on other people’s websites. He’s totally right: they do. They’ve learned how things should work (including links opening in the same window and right-click bringing up a context menu) and if you try to change that, you won’t make those users learn a whole new paradigm just for your website; they’ll just go to a website that they don’t have to figure out. Most likely one run by your competitors.

  24. […] here: Share this:TwitterFacebookLike this:LikeBe the first to like this […]

  25. […] If you want to be an a**hole, here’s Javascript code that disables right-click, selecting text, dragging content, closing th… […]

  26. Evil collection of annoying JS all in one place. More website should send reminders when their users ‘accidentally’ close the window.

  27. […] library with examples of JavaScript techniques you can use if you want to scare your visitors away. Visit this link Source: CSS Globe Tweet#call_to_action h4{padding:0px […]

  28. very interesting way. I do like the way you say to turn of the right click menu for HTML5 Dev. There is definitely a place for this library in web development.

Be the first to know about new releases!

Newsletter subscribers will be the first to know about new apps I release or new articles I write, here or elsewhere.

Low-volume. I will only email you when I have something exciting to share.