News for hackers. Stuff that matters.
Re:Hotlinking to jquery.com will be disabled on January 31, ... by tlrobinson on Friday December 31, 2010 @01:35PM (#2056032)

    if (location.host.search(/crockford.com$/i) != -1) {
        throw "Stop hotlinking me!";
    }
Re:Hotlinking to jquery.com will be disabled on January 31, ... by simonsarris on Saturday January 01, 2011 @12:36AM (#2057285)
You code should read != 0 to have the desired effect.

And even then, this can bypass it:

  var temp = String.prototype.search;
  String.prototype.search = function() { return 0};

    if (location.host.search(/crockford.com$/i) != 0) {
        throw "Stop hotlinking me!";
    }

  String.prototype.search = temp;
Though that may cause other problems.
Re:Hotlinking to jquery.com will be disabled on January 31, ... by tlrobinson on Monday January 03, 2011 @01:52AM (#2062416)
My point was that it's just a game of cat and mouse. I could come up with lots of workarounds for almost anything you throw at me. Example:

    var expectedHost = "crockford.com";
    if (expectedHost.length !== location.host)
        throw "Stop hotlinking me!";
    for (var i = 0; i < expectedHost.length; i++)
        if (location.host[i] === expectedHost[i])
            throw "Stop hotlinking me!";
(though it string[x] might not work in every browser)

So thanks for further demonstrating my point!

But really, just check the referrer header.