Possible Duplicate:
How to prevent downloading images and video files from my website
I am developing my own website.
In this website I need to add a feature which prevents downloading images and code.Is it possible to prevent the downloading of images and code form my website ?
Please reply. Thanking you and Kindly Regards
The only way to prevent people downloading things from your website is not to put them on your site in the first place. Here's how a website works:
Computer: Hey, Example.com Server, can you send me the page "cupcakerecipes.html"?
Example.com Server: Why, sure I can. Here's the page.
Computer: I see this page includes the image "deliciouscupcake.jpg" — can you send me that image so I can show my user the delicious cupcake?
Example.com Server: Oh, yeah, here ya go, buddy.
Computer: Hey, sorry to bug you again, but I see the page wants me to run the script "animatesprinkles.js" — can you send that too so I can run it?
Example.com Server: Of course!
See, at each step of the way, the user's computer is downloading the resources he needs. If you do not allow the user's computer to download your images and scripts, he can't see them or run them.
Simple: Keep the website on your own machine, never put it up on the web.
There is NO other answer. It's impossible to view a website without first downloading the page(s) you are viewing. Browsers normally respect instructions from the web page as to what shouldn't get saved but this is entirely under the control of the browser and not the website.
Programs exist that pretend to be browsers and download entire websites, although I have never seen one that always worked.
Firefox is open source, anyone could download it and modify the code that controls what doesn't get saved.
I have personally written a couple of programs to scrape data off websites--the website would never know it's not an ordinary browser.
While you can't stop users from downloading your content, you can stop them from legally using it. Get a federally registered copyright for the material (or not, it is copyrighted as soon as it is published, but a federal copyright removes all doubt), and then have a good IP lawyer on hand to fight the inevitable battles.
If you wish to stop people from downloading from your site, then you wish them to not be able to access your site, no? If they cannot download anything, there is nothing to see.
You can prevent other sites from hotlinking images from your site by creating a file called ".htaccess" in your website's document root folder. The following is what you want to put inside of the .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain\.com/ [NC]
RewriteRule \.(gif|jpg|png)$ - [F]
精彩评论