Introduction:
Here I will explain how to disable right click on right click only on images using JQuery in asp.net.
Here I will explain how to disable right click on right click only on images using JQuery in asp.net.
Description:
In previous article I explained disable right click web page using JQuery. Now I will explain how to disable right click only on images using JQuery in asp.net.
In previous article I explained disable right click web page using JQuery. Now I will explain how to disable right click only on images using JQuery in asp.net.
To
implement this one we need to write code as shown below in your aspx page
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>jQuery disable right click on webpage using asp.net</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript" language="javascript">
$(function()
{
$('img').bind("contextmenu", function() {
return false
});
});
</script>
</head>
<body>
<form id="form1"
runat="server">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ3C-tQDXPIMmR_dS4yVjSxehkRh6cA3XmKuGynVFcv0my1TMzWis9ucLgUvpBhQ76zwFfKrp5SieMfZjZmiWdk8DCcL8rlv315aRPY8u3RjzO1zBros0Dm9NtVljyBYMtukeEmxuR01Q/"
alt="Aspdotnet-Suresh"
/>
<div>
Aspdotnet-Suresh offers Asp.net,C#.net,SQL
Server,Web Services,WCF,
WPF,MVC,Crystal Reports,AJAX,XML,JavaScript,JQuery,Gridview
articles,
samples and tutorials,code examples of
asp.net 2.0,3.0,3.5,4.0 and Articles,
examples of .net technologies
</div>
</form>
</body>
</html>
|
If
you observe above code in header section I added script file link by using that
file we have a chance to interact with JQuery and in the script we have bind event
with contextmenu which is used to
disable right click on images based using JQuery in asp.net.
Demo
To
test this demo right click on the below logo(Aspdotnet-Suresh) you won’t get
any right click and now go to the text below the logo(Aspdotnet-Suresh) and try
to right click now you are able to get right click in this way we can restrict
right click for images
Aspdotnet-Suresh offers Asp.net,C#.net,SQL Server,Web Services,WCF,
WPF,MVC,Crystal Reports,AJAX,XML,JavaScript,JQuery,Gridview articles,
samples and tutorials,code examples of asp.net 2.0,3.0,3.5,4.0 and Articles,
examples of .net technologies
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
6 comments :
I Wana Provide Secuirty When Webpage Saveas Tht Time also Photo Is Not Download....
In Short End User Can't Download Photo Anyway..
What is intresting about you sir "Aap Gyan ka sagar ho mai ek pyasa." you have each and everything that I need to know , You are my Real Guru by reading your website I got placed in a reputed software company ,
Thanks and Regards,
Er. Abhinav Kumar Singh
To whom without who thought me everything aboout ASP.NET
thanks a lot
Your all articles are very useful covers most of …
THANK YOU.
If I drag that image on new tab on browser, then I am able to save that image. There should be security like right click should disable, and also no one can drag that image from web page to other tab..
When I try to save this image using touch screen mobile its allowed to save the image.
Note: Only a member of this blog may post a comment.