109 points · by surreal · 12y ago · 66 comments
https://github.com/kitcambridge/evil.js/blob/gh-pages/evil.j...
This is totally wrong. Javascript has nothing whatsoever to do with Java. It only has a few very superficial syntactical similarities (curly brackets, semi-colon at the end of each line, and that awful 'new' keyword). JSON, on the other hand, stands for "Javascript Object Notation", and can be interpreted as Javascript (with 'eval'). It's explicitly meant for storing and transmitting javascript data, so when there's a javascript data value that is not supported by JSON, that is absolutely relevant.
Now that we've all had a laugh, wouldn't it make more sense to have the server respond with a redirect to a shared copy of the script hosted somewhere that provides bandwidth for free? (Perhaps this is a sign that the script should be open-sourced as well.)
if(!window.location.host.match(/(www\.)?myapp.com/)) window.location = 'http://www.myapp.com';
I bet they won't hotlink after that.I'd be surprised if they actually have a leg to stand on legally if they are hotlinking off someone's site, especially if there's have no prior agreement to allow them to do so.
I think the idea is more that if someone is eating your bandwidth by hotlinking your jQuery.js, then you can serve them this instead.