Disabling right-click on websites provides basic security so that people don't save images and copy links and text.
Today, in this article I will show you how you can also disable right-click on your website.
Let's disable the right-click
document.addEventListener('contextmenu', event => event.preventDefault());
Tada! Right-click has been disabled on your website 🎊
I hope this blog post has helped you understand how to disable right-clicking on websites.
If you found my content helpful and would like to thank me, feel free to Buy me a coffee :)
Have a great day!