Some people are staling my website images, i know that its HARD to protect the images, But i am trying to disable the right click on the images ONLY Can anybody provide me a valid jquery code or PHP code that can do that? Please don't give me JavaScript code, i hate javascript, a simple HTML/jquery/PHP code that i can place my image within it will be fine Thanks
Quick question... what do you think the J in JQuery stands for? This can't be done in PHP and the JQuery solution (if someone bothered to write one) would most likely be overkill. Sorry but your best bet is to go with javascript.
Well i think its possible to do it with jquery, this site is done a similar solution with JQuery: http://davidwalsh.name/image-protector-plugin-for-jquery but i just failed to setup their code/plugin I don't know.. anyway do you think JavaScript will not make problems for my website? because actually my website is very well-designed and its codes are clear, i just don't want to damage it with stupid codes... Thanks
Like I said, using JQuery involves loading 1-2 libraries that are 30-40KB in size and the javascript solution is only a few lines of code. Personally I wouldn't want to load that much redundant code because it will slow down the site. I just googled how to do this in javascript and I've seen a prehistoric solution from the netscape days posted in several places. I did however find something very elegant: <body oncontextmenu="return false;"> That's it. Much nicer than JQuery.
there is no way to do that i mean there is no way to disable rightclick because if you disabiled any one will disable the java script from his explorer and right click you should make disable hot linking from your cp
Like astkboy says, disabling right click isn't the solution. Use .htaccess: RewriteEngine On RewriteCond %{HTTP_REFERER} !^[url]http://(.+\.)?domain\.com/[/url] [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L] Code (markup): Where /images/nohotlink.jpe is an image where it says they can't hotlink the images (use .jpe because otherwise it will block that image too!). Put your site also in that image and it might even give you some visitors.
Why disable right clicking? 1st it's annoying 2nd you can still copy/paste by viewing the source code of the page 3rd it makes no sense to disable right clicking! Disable hotlinking is better
I vote the simplest solution. It doesn't require javascript or php. It works with every browser and its backward compatible. It's called: Get over it. For one, there is no perfect or even adequate technological solution. For two, I am almost certain no one is making any money nor causing you any financial damage from said images. For three, its very easy to send a DMCA notice to the offending party--assuming of course they are violating the DMCA.