In this article we will explore how to disable right click of mouse button when javascript is enabled. We will also find out the way to inform user whether javascript is enabled or disabled. If javascript is disabled right click will work otherwise it won't work.
Let's write some code to achieve it.
Step 1: Include jquery in the head section of aspx page.
Step 2: Place noscript tag along with the content in the body tag. noscript tag runs only when javascript is disabled.
Step 3: Place the below div inside the body tag. It will be hidden and will be displayed only if javascript is enabled.
Step 4: Place below javascript to display above div and disable right click of mouse.
Live Demo Like us if you find this post useful. Thanks!
No comments:
Post a Comment