5.5. Disabling Image Download

Problem

You need to prevent visitors to your web site from downloading proprietary images displayed on your site.

Solution

JavaScript, DHTML, and other sneaky coding tricks can be used to discourage, if not completely prevent, visitors to your web site from copying images from your web pages. None of the free options are impenetrable, but together they may be enough to ward off the less dogged online poachers. Consider these methods the equivalent of a cheap bike lock—it works great until the thief with bolt cutters finds it.

  • Disable the right-click (and therefore Save Image) feature

  • Disable Internet Explorer's Image Toolbar

  • Place invisible layers over your images

  • Store images in a protected directory

Discussion

The Internet has a love-hate relationship with stealing. Viewing the source code of a nifty-looking web page is by far the most popular method for learning about web design (after reading this book, of course). By borrowing a snippet of code from one site and adapting a bit from another, web designers have been advancing the state of their art for years—and few of their "victims" would consider what they're doing stealing. But then there's the whole Napster thing…

To be sure, the fruits of an artist or photographer's labors have more in common with music than HTML. Web page code—the structural part, not the content—is a commodity. There are only so many ways you can make a page look the way it does. If you find a new approach, you're almost obligated ...

Get Web Site Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.