Annoying.js: How to be an asshole
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.
Annoying.js
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!
78 comments
heh they’ve forgotten about blocking the console ? :)
Annoying is right, and when you tell them you can defeat all their “security” by turning off javascript, they just stick their head in the sand and refuse to make the visit less painful.
You forgot “reload page once per minute”
Here’s another I’ve been asked to implement on occasion: automatically modify all links pointing to external sites to forcibly open in a new window. You don’t want people to leave your website.
Seriously, post the code on GitHub! I’m pretty sure everyone will have a little annoying snippet to commit
Your onTop() function wasn’t annoying enough. I fixed that for you.
/**
* Make certain we're not loaded into an iframe
* Warn user that we don't like this via a modal dialogue; this is more important
* than our content.
*/
a.onTop = function () {
if (parent.frames.length > 0) {
alert ("For security reasons, framing is not allowed; click OK to remove the frames.")
top.location.replace(document.location);
}
}
Dickbars would be a great addition
I made this little snippet, which destroys most popular JS libraries in use…
https://gist.github.com/942745
Might make for a good addition, for further annoyance.
And please don’t forget to open every external link in a new window
alert(“Thanks for visiting our website! “)
“Using JavaScript to resize someone’s browser without consent should be reason enough to revoke someone’s license to making websites, though.”
I HATE that! And some of the support pages for my own hosting services have the nerve to do it!
and not to forget the onunload return visitor to my website.
You forgot “copying your site’s URL to the clipboard”…
I use the firefox addon scrapbook. When I go to print view on some sites it doesn’t bring up the printed view but the printer dialog pops up. Any way to disable this?
[...] [...]
How about a “bookmark” alert?
How about autorefresh every 5 minutes?
a.autorefresh = function(){
setTimeout(function(){
window.location = window.location;
}
,1000*60*5
}
I’m pretty sure the right click function could do with an alert(‘Right click forbidden’)
[...] Annoying.js: How to be a perfect asshole to your website users – all in one js script! [...]
Great job :D
Since I use tabs so much in Chrome, I am not sure I understand the hate for opening external links in new windows. I think I prefer that.
Blocking keyboard commands such as ctrl/command + a / c / v and the likes would up the annoyance level for power users. And the popular “Are you SURE you want to leave this site and miss out on the awesome content?” confirmation prompt onunload is always a good addition to annoyances. And stupid effects following the cursor always drives me insane.
Would you please change the cursor ? And add a tail ?
“And please don’t forget to open every external link in a new window”
Make sure the javascript for this makes it impossible to middle-click to open in a new tab, too, eg. by setting the onclick to “javascript=;”.
Seconding (or thirding) the reload every minute too, and make sure the reload snaps the scrollbar back up to the top of the page.
Auto-logout modals and warnings are great too, perhaps throw up a “you have been idle” warning every 15s, and a logout modal after 60s, forcing the user to log back in again (for a page purely being annoying this could be a captcha rather than actually requiring a registration and user+pass)
For that matter, obnoxious registrations and login functionality is a whole game of its own, with “that username is taken” notification after submitting, which requires re-filling in most of the registration, likewise with absurd password requirements (“snuffaluffagus%#14234″ is based on a dictionary word, “snuff”, please try a more secure password) that again cause the registration to reset.
Back to the copy-paste category, use some gimmick to make the start of every paragraph (or heck, word) be an image embed to break text resizing as well as copy-pasting.
Nice list! But you forgot the best:
window.onerror = function() { return false }
Disable those irritating IE error popups and yellow icon in statusbar :)
It all good now..
[...] Sore EyesLog inAnnoying.jsMay 23rd, 2011Annoying.js: /** * Annoying.js – How to be an asshole to your users * * DO NOT EVER, EVER USE THIS. * * [...]
Re: https://gist.github.com/942745
Thats actually a great little addition. Its the suckful programmers that rely on libraries who cause this kind of grief to begin with.
Oh yeah heres another annoying feature “please fill in the email field”, but i see you’ve got that one covered.
Haha, love it. Github this for sure!
Just in-case the user realizes she didn’t want the window resized…
window.onresize = function() {
window.resizeTo(1024,768);
}
The “Always open the link on a new page” REALLY is irritating, and the websites blocking the middle click for opening tabs even more….
Hey, this is great and really useful! But the mother of annoyance is missing. We want Pop Ups (fullsize)!
You might include stars or text following the mouse pointer. Awesome.
No need to use annoying.js … Just use flash where most of those little tricks are default behaviour.
It is missing a “preventing the breaking of a superinjunction” function (which would rhyme and so be doubly cool).
[...] Annoying.Js: How To Be An Asshole (via Waxy) [...]
[...] dem Titel Annoying.Js hat Entwickler Kilian Valkhof ein Script zusammen gestellt, das alle beliebten und weniger [...]
[...] Então decidiu copiar essas funções e criar uma biblioteca como exemplo de técnicas que se podem usar para assustar e irritar os visitantes. E assim nasceu a Annoying.js. [...]
[...] techniques you can use if you want to scare your visitors away, or want to piss them off. Annoying.js is the [...]
[...] Kilian Valkhof hat alle fiesen Javascripte die einen z.B. daran hindern rechts zu klicken um Bilder zu kopieren zu einem Script gebündelt. [...]
Now thats one hell of a script you do not want to bump into in a dark alley ;-)
[...] Website: http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ [...]
thanks..! nice tuts.. :)
[...] Annoying.js, a collection of scripts you can use if you want to piss off your visitors. « Aside: FitText <aside> [...]
[...] techniques you can use if you want to scare your visitors away, or want to piss them off. Annoying.js is the [...]
[...] annoying.js Posted on 24. May, 2011 by Andreas Das BESTE, das Web 2.0 zu bieten hat. “How to be an asshole” Javascript code. http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ [...]
For all those new links opening in new windows…what about a “popUnder” function that not only opens them in a new window, but pushes that window to the bottom of the stock and places the focus back on the link that was clicked? Now it isn’t even obvious that the link was clicked at all unless you are really paying attention!
I also want to start my own list…this could be awesome!
[...] puede ser muy malo con los usuarios de tu página, Kilian Valkhof a recopilado algunos de los scripts más molestos dando como resultado: Annoying.js. /** * [...]
[...] Annoying.js: How to be an asshole • Javascript • Kilian Valkhof 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. (tags: web-developer web-developer/javascript funny tips disturbing @twitter) [...]
There are good reasons for using two of those at times. Disabling copying of content is perfectly legitimate to help protect copyrighted material. Opening external links in new windows is also reasonable in places when you are referencing external information to assist others. I find it more annoying to have to surf through history to get back to the original page instead of just going back to the original tab.
A classic annoying JavaScript use is to use a blur() method call to disable the “outline” that indicates focus on an element. It was really awful because when they did that you could not tab through a webpage properly.
Classically it was:
<a href=”#” onfocus=”this.blur()”>link!</a>
Perhaps worthy of an addition, though I believe people now use the CSS outline: none; to accomplish this now.
How about adding badly rendered dropcaps at the start of every paragraph (not just at the start of every article)?
How about cursor:none on body tag :D
[...] http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ annoying.js – sooo nice and evil idea [...]
Rob,
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…
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.
[...] 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) [...]
[...] 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) [...]
Found this on a solution provided by the “leader in SaaS solutions for the hospitality industry”, needs to find a home in annoying.js:
preventBack()
https://gist.github.com/1000605
[...] techniques you can use if you want to scare your visitors away, or want to piss them off. Annoying.js is the [...]
[...] techniques you can use if you want to scare your visitors away, or want to piss them off. Annoying.js is the [...]
YMMD :)
bindEvil!
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); };
}(Annoying));
[...] Qui trovate Annoying.js. [...]
[...] 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. [...]
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!
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.
I would add preventing any keyboard event and trying automatically to add to favourites
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.
[...] Visit this link [...]
[...] Annoying.Js: How To Be An Asshole urbanlegend.hu What the Hex? [...]
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
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.
[...] here: http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ Share this:TwitterFacebookLike this:LikeBe the first to like this [...]
[...] If you want to be an a**hole, here’s Javascript code that disables right-click, selecting text, dragging content, closing th… [...]
Evil collection of annoying JS all in one place. More website should send reminders when their users ‘accidentally’ close the window.
[...] 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 [...]
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.