Content Listing:
- How do I keep people from saving my images?
- How can I hide my source code?
- How do I add an icon to the addressbar for my site?
How do I keep people from saving my images?
Images placed on the Internet are available for all to download. There is no way to display your image in the browser, yet keep people from saving them. If your images are that important, don't place them on the Internet! There seems to be a general confusion that a no right click script will protect images from being saved. This is untrue. Here are some of the methods one could use to save images from the Web:
- Right click, Save As
- Save the entire web page with File, Save As
- Get the images out of the Temporary Internet Files directory
- Use a screen capture program, or the Print Screen button
What do you do? Your best bet would be to add a watermark to the image. A watermark is a semi-transparent bit of text that you overlay your image with, to show that it is yours. Generally, it is added to a lower corner of your image. This will allow viewers of the image to see that it is your image.
How can I hide my source code?
It is virtually impossible to make your source code unassailable. Nearly every method suggested to encrpyt, obfuscate or make your source code invisible can be broken by an experienced user, and many methods cause problems for normal users, making your site appear much less professional and encouraging them to go elsewhere. Ask yourself: is my source code really that important?
To illustate, here are some of the main methods used for hiding source code, and their disadvantages:
- Disable right-click, make access to "view source" menu option awkward, etc. Usually, these methods use Javascript (which means they fail for around 13% of web users), and anyway they can easily be worked around. Try adding "view-source:" before the URL in your browser's address bar - no script can prevent that. Scripts like this make life difficult for regular users, and do not stop a determined user.
- Generate content through Javascript. This usually involves escaping the content then applying the JS unescape() function, or putting the content in an external file. Most comptent Javascript programmers can undo this, and it will make your pages inaccessible to those without Javascript.
- Show pages through a complicated network of chromeless windows, framesets, etc. Again, this can relatively easily be cracked, but the numerous browser/version differences mean it limits who can use your site and causes serious accessibility issues.
No doubt other methods of hiding source code are available, but they almost always mean your page is in violation of accessibility recommendations, and doing that on a commercial site could be construed as illegal and US and UK law (the Americans With Disabilites Act and the Disability Discrimination Act respectively). It really isn't worth the hassle.
References:
http://www.usdoj.gov/crt/ada/ - Americans With Disabilities Act
http://www.disability.gov.uk/dda/ - Disability Discrimination Act
http://www.w3.org/WAI/ - Web Accessibility Initative
How do I add an icon to the addressbar for my site?
This icon is known as a "favicon" and displays in the addressbar, and in some browsers the favorites/bookmarks list as well. To add one to to your page, use something like the snippet below in the <head> tag, replacing the URL with the address of your icon.
Note that you must use an ICO (icon) file, created in a decent image editor, as an ICO is in fact two images - 16x16 and 32x32 pixels. For more information on favicons, check out http://www.favicon.com/.