Viewing Prevent Image Right Click

Prevent Image Right Click



User: Roddy 8 years ago
This got buried in another post and may be of interest for those who don't want their images easily downloaded.

java script can be used to specifically target right click on images only...

<script>
document.oncontextmenu = function(e){
var target = (typeof e !="undefined")? e.target: event.srcElement
if (target.tagName == "IMG" || (target.tagName == 'A' && target.firstChild.tagName == 'IMG'))
return false}
</script>

NOTE: This code must be pasted into the Footer Code box in the Page inspector to protect one page or in the one in the Site Publishing Settings page to do the same for the whole site. It must appear after all the <img> tags on the page to be effective.

It won't prevent images being downloaded via the page source code so make sure you import images into EverWeb at the size they will appear on the page and don't provide a retina @2x version.

For example, if an image is going to be 640px x 480px on the web page then that's the size it should be reduced to before adding it to the Assets List in EverWeb. This size will look OK on the page but is too low quality for others to rip off and make prints etc.

Images can be quickly resized by launching them in Preview.app and then using "Adjust Size..." in the Tools drop down menu.

-------------------------------
Roddy

Website: http://everwebwidgets.com
Contact: http://everwebwidgets.com/ewWidgets-home/contact.html
NOTE: I am an EverWeb user and NOT affiliated with EverWeb! Any opinions expressed in this forum are my own.
User: Don B. 8 years ago
Thanks Roddy. This works great!
User: Roddy 7 years ago
See THIS topic for a convenient way to watermark images in EverWeb.

-------------------------------
Roddy

Website: http://everwebwidgets.com
Contact: http://everwebwidgets.com/ewWidgets-home/contact.html
NOTE: I am an EverWeb user and NOT affiliated with EverWeb! Any opinions expressed in this forum are my own.


Post Reply
You must login or signup to post.