Geek Speak — HabitableZone

Geek Speak » in reply to Tom: re that hotlinking thread

Image protection on the Net

I guess I should've commented earlier, but I thought that that thread had explained it.

What's going on is that the server hosting the image has software that tries to ensure that images are displayed only on that site. Most will just refuse to send an image, resulting in the "X" broken image icon. These guys are doing something cute by sending out that cartoon.

I've been researching how to do it for a photosharing site I'm building. One way is to look at a piece of info the browser sends called "REFERER" (misspelling enshrined in the spec), which is the page on which the image appears. If it's not one of the server's pages, it rejects the request. If you were to copy-n-paste the URL into your browser's address box, the browser will send an empty REFERER. Some image-protection software will allow it because early versions of FireFox incorrectly sent an empty REFERER even when the image was on a page; or the programmer might decide to block when REFERER is empty.

Another technique is to expect a cookie for the image folder or even the specific image. That would guarantee that you'd get the image regardless of whether the image was on a page or a naked URL (e.g. bookmark), because browsers associate cookies with URLs.

The cartoon was cute, but it's a bit cryptic. I didn't figure it out right away. I'd send a useful graphic with an error message, and the URL of the site where the image can be viewed. That way you don't baffle people and make them spend a day figuring out WTF is wrong, and you encourage visitors to the site. Good tech, lousy way to treat visitors.

Log in or register to post.

The whole thread (5 posts)