Jump to content

Disable right click. on images with just CSS

Recommended Posts

Is there a code to disable right-click with JUST CSS, every code I happen upon either is just for the Advanced code injection for header/footer (which my plan doesn't support), or if it is for CSS, it just downloads a few images from your page or a html file.

Thanks in advance!

Edited by ec25
Link to comment

CSS can change how things look but not how they work. CSS is like makeup.

To change how things work you need JavaScript. JS is the plastic surgeon.

Folks are overly concerned about their images being copied. Be aware, even if you use JavaScript someone who really wants your images can defeat your JS code and get them anyway. If you don't want your images shared, don't put them on the internet.

 

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment

Whole-heartedly agree with @creedon, there are multiple ways to save an image on a web page without right-clicking. The best suggestion I have is you can protect your images from unauthorized commercial usage by keeping the image size as small as you can get away with and compressed, never put the original image online (this is also good for page load times). This isn't a perfect solution, but will make your image unsuitable for many uses (until AI can upscale your image... but that opens up so many more future issues) and you can at least potentially protect your copyright by owning the original image.

Additionally, this CSS can prevent clicking on images...but that can impede the usage of your website if you have any image with click-through links.

img {
  pointer-events: none;
}

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

 Did I help? Buy me a coffee?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.