Check for referal headers and throw a 301.
Check for referal headers and throw a 301.
OK, that was a bit of an exaggeration. But back in my day the web had a whole site high-bandwidth site specifically for educating careless webmasters about the dangers of hotlinking: g o a t s e . c x.
It was used to great effect on things like auction sites where the original page html was not allowed to be changed after listing.
Some idiot at Company X decides that it's actually your fault, since its your script that did it. To save face, they get an expensive lawyer to sue you. Next thing you know, you're a registered sex offender.
Please learn the difference between civil and criminal law.
I never did a hotlink again.
As someone affected by this, I learned my lesson, but I was very happy about how the hotlinking was handled, I was a clear impossible to miss warning, with a clear and easy solution, I though it was only fair.
The nice part about using Google is first off it offers speed advantages (as most people will have Google's JQuery lib cached already), secondly I don't expect Google to get hacked, and lastly we have Google's permission to do exactly that.
Regardless of what your privacy policy states, the responsible thing to do is to at least give your users the option of opting out of such tracking by third-parties, all while still leaving your site usable.
Reddit do this. You can choose to load their js from their own servers rather than a CDN.
if(/whatispolymath/.exec(location.href)) alert("...");