Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Right Click Disable

Right Click Disable

Scheduled Pinned Locked Moved ASP.NET
help
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    varshavmane
    wrote on last edited by
    #1

    Hi All, I have to disable right click and backspace key of IE.Can anyone help me in doing this. Thanks...

    E 1 Reply Last reply
    0
    • V varshavmane

      Hi All, I have to disable right click and backspace key of IE.Can anyone help me in doing this. Thanks...

      E Offline
      E Offline
      ednrgc
      wrote on last edited by
      #2

      It's basically a waste of time. It can be done with javascript (see google), but it's so easy to circumvent, it's not worth the time implementing it.

      V 1 Reply Last reply
      0
      • E ednrgc

        It's basically a waste of time. It can be done with javascript (see google), but it's so easy to circumvent, it's not worth the time implementing it.

        V Offline
        V Offline
        varshavmane
        wrote on last edited by
        #3

        I got some code but not getting where should I call them??? Following is the code which I got: Code 1: function Disable() { if (event.button == 2) { alert("This action is not possible") } } document.onmousedown=Disable; Code2: var message="foo"; function click(e) { if (document.all) { if (event.button==2||event.button==3) { alert(message); return false; } } if ((document.layers)||(window.navigator.userAgent.toLowerCase().indexOf('gecko ') != -1)) { if (e.which == 3) { alert(message); return false; } } } if ((document.layers)||(window.navigator.userAgent.toLowerCase().indexOf('gecko ') != -1)) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=click; Code3: var am= "This function is disabled!"; bV = parseInt(navigator.appVersion) bNS = navigator.appName=="Netscape" bIE = navigator.appName=="Microsoft Internet Explorer" function nrc(e) { if (bNS && e.which > 1) { //alert(am); return false } else if (bIE && (event.button >1)) { //alert(am); return false; } } document.onmousedown = nrc; if (document.layers) window.captureEvents(Event.MOUSEDOWN); if (bNS && bV<5) window.onmousedown = nrc; Please help me... Thanks...

        C 1 Reply Last reply
        0
        • V varshavmane

          I got some code but not getting where should I call them??? Following is the code which I got: Code 1: function Disable() { if (event.button == 2) { alert("This action is not possible") } } document.onmousedown=Disable; Code2: var message="foo"; function click(e) { if (document.all) { if (event.button==2||event.button==3) { alert(message); return false; } } if ((document.layers)||(window.navigator.userAgent.toLowerCase().indexOf('gecko ') != -1)) { if (e.which == 3) { alert(message); return false; } } } if ((document.layers)||(window.navigator.userAgent.toLowerCase().indexOf('gecko ') != -1)) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=click; Code3: var am= "This function is disabled!"; bV = parseInt(navigator.appVersion) bNS = navigator.appName=="Netscape" bIE = navigator.appName=="Microsoft Internet Explorer" function nrc(e) { if (bNS && e.which > 1) { //alert(am); return false } else if (bIE && (event.button >1)) { //alert(am); return false; } } document.onmousedown = nrc; if (document.layers) window.captureEvents(Event.MOUSEDOWN); if (bNS && bV<5) window.onmousedown = nrc; Please help me... Thanks...

          C Offline
          C Offline
          Craster
          wrote on last edited by
          #4

          To echo the previous - waste of time. What are you going to do when the user disables Javascript? More to the point, it's immensely annoying when a web developer decides I can't have control of my browser. Find another way to solve whatever problem you have.

          V 1 Reply Last reply
          0
          • C Craster

            To echo the previous - waste of time. What are you going to do when the user disables Javascript? More to the point, it's immensely annoying when a web developer decides I can't have control of my browser. Find another way to solve whatever problem you have.

            V Offline
            V Offline
            varshavmane
            wrote on last edited by
            #5

            Our Project requirement is that no one should view the source code so I need to disable right click. Please tell me how do I go about it. Thanks...

            C 1 Reply Last reply
            0
            • V varshavmane

              Our Project requirement is that no one should view the source code so I need to disable right click. Please tell me how do I go about it. Thanks...

              C Offline
              C Offline
              Craster
              wrote on last edited by
              #6

              varshavmane wrote:

              Our Project requirement is that no one should view the source code so I need to disable right click.

              It's not going to happen. Disabling right click is not going to help. If you want to keep your code hidden, run it on the server. If you pass the code to the client, there will always be a way for them to get access to it. Disabling right click is a waste of time. Or rewrite the whole thing as an ActiveX/Java client.

              V 1 Reply Last reply
              0
              • C Craster

                varshavmane wrote:

                Our Project requirement is that no one should view the source code so I need to disable right click.

                It's not going to happen. Disabling right click is not going to help. If you want to keep your code hidden, run it on the server. If you pass the code to the client, there will always be a way for them to get access to it. Disabling right click is a waste of time. Or rewrite the whole thing as an ActiveX/Java client.

                V Offline
                V Offline
                varshavmane
                wrote on last edited by
                #7

                I have remove all the toolbars of IE and now I want that right click should be disable so that no one can get the code via right click or by going to view source. Please help me...

                S W 2 Replies Last reply
                0
                • V varshavmane

                  I have remove all the toolbars of IE and now I want that right click should be disable so that no one can get the code via right click or by going to view source. Please help me...

                  S Offline
                  S Offline
                  szukuro
                  wrote on last edited by
                  #8

                  Like said before, you can't hide your code. Even if you hide the toolbars and disable temporary internet files. The only thing you can accomplish is make it harder to get the code.

                  1 Reply Last reply
                  0
                  • V varshavmane

                    I have remove all the toolbars of IE and now I want that right click should be disable so that no one can get the code via right click or by going to view source. Please help me...

                    W Offline
                    W Offline
                    Walter_H
                    wrote on last edited by
                    #9

                    have you ever heard of fiddler?[^] what you are trying to do is not possible as long as tools like fiddler are available for everyone.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups