THEMETRIAL

Protect Images From Theft Using The ProtectImage.js Library

Author:ColonelParrot
Views Total:0 views
Official Page:Go to website
Last Update:May 17, 2021
License:MIT

Preview:

Protect Images From Theft Using The ProtectImage.js Library

Description:

ProtectImage.js is a tiny (less than 1kb) JavaScript library that protects images on your site from theft by disabling right-click and hiding the image source in the console log.

How to use it:

1. Import the script.min.js JavaScript library into the document.

<script src="https://www.cssscript.com/src/script.min.js"></script>

2. Add the protected attribute to images.

<img src="https://www.cssscript.com/1.jpg" protected />

3. Initialize the library and done.

window.onload = function() {
  ProtectImageJS.init()
}

4. The library will show the image on an HTML5 canvas element instead and hide the real image path in the console log:

<canvas width="620" height="465"></canvas>
<img src="" protected="">


Source link

Add comment

NOTE :

All visitors can share my site’s content on their blogs, sites, and social networks to enrich the content

Only share the source www.themetrial.com

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.