Disable right click? Disable view source?

Discussion in 'HTML & Website Design' started by durhamclubinfo, Oct 2, 2008.

  1. #1
    Does anyone have the code for disable right click?

    and also can you disable view source?
     
    durhamclubinfo, Oct 2, 2008 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    Can't be done, and it's silly to try. It's silly to want to try.

    cheers,

    gary
     
    kk5st, Oct 2, 2008 IP
  3. ThoughtPunk

    ThoughtPunk Active Member

    Messages:
    1,135
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    78
    #3
    ThoughtPunk, Oct 2, 2008 IP
  4. AnonymousUser

    AnonymousUser Peon

    Messages:
    593
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can disable right click,with javascript, But all the user has to do is turn javascript off and they can right click

    e.g. http://dragonballz.com/
     
    AnonymousUser, Oct 2, 2008 IP
  5. deviataz

    deviataz Active Member

    Messages:
    179
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    75
    #5
    You can circumvent the lack of a right click menu by holding left mouse button and clicking the right one (most scripts), so it's useless in my opinion. As for disabling the source code, it can't be done. Every mouse button menu has the same options in the browser menu. Further, FireFox as far as I know doesn't follow disabling mouse menu scripts.

    You can scramble the source code though using javascript. It'll look like hexcode. But there are unscramblers, so I'd say, why bother.

    Anyway, reconsider. Disabling the mouse menu is unfriendly, irritating and unnecessary.

    If you want to pursue it anyway: dynamicdrive.com / wsabstract.com - both loaded with scripts.
     
    deviataz, Oct 2, 2008 IP
  6. Ecreation

    Ecreation Active Member

    Messages:
    823
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    68
    #6
    to disable view source you can open your page in a new window without the menubar, using javascript "window.open()" method.
     
    Ecreation, Oct 2, 2008 IP
  7. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #7
    Right click is disabled in Safari and IE, but it has no effect on viewing source. Opera and Firefox simply ignore it and pop up the expected right click menu.

    It's an ineffective, silly idea, but if it makes you feel good …

    gary
     
    kk5st, Oct 2, 2008 IP
  8. alexa_lucky

    alexa_lucky Banned

    Messages:
    94
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    For right click with message: nope

    <script language=JavaScript>
    <!--
     var message="nope";
     function click(z) {
      if (document.all) {
       if (event.button == 2) {
        alert(message);
        return false;
       }
      }
      if (document.layers) {
       if (z.which == 3) {
        alert(message);
        return false;
       }
      }
     }
     if (document.layers) {
      document.captureEvents(Event.MOUSEDOWN);
     }
     document.onmousedown=click;
    // --> 
    </script>
    Code (markup):
     
    alexa_lucky, Oct 2, 2008 IP
  9. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #9
    @alexa_lucky: Only IE is stupid enough to fall for that attempt. Firefox, Opera and Safari ignore it. That may be because the javascript is very old proprietary stuff. Not at all standard.

    cheers,

    gary
     
    kk5st, Oct 2, 2008 IP
  10. alexa_lucky

    alexa_lucky Banned

    Messages:
    94
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Yes, if you are smart enough why dont you show him a better idea ?
     
    alexa_lucky, Oct 2, 2008 IP
  11. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #11
    I already showed him the better idea and he got a case of red-a$$. The idea of disabling right click or trying to hide the source code is silly. Period. Full stop.

    gary
     
    kk5st, Oct 2, 2008 IP
  12. durhamclubinfo

    durhamclubinfo Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    ohhhhh no worries guys
    i got violations for posting in this thread because some guy called my question silly
     
    durhamclubinfo, Oct 3, 2008 IP
  13. konrad

    konrad Peon

    Messages:
    808
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Good article. I dont understand why people try to disable it...
     
    konrad, Oct 3, 2008 IP
  14. James Edwards

    James Edwards Banned

    Messages:
    200
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #14
    to konrad, I guess so that they can not view source?
     
    James Edwards, Oct 3, 2008 IP
  15. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Ah, to be clear, if the browser can see the source enough to build the page, then the user can also see the source. If you block the source you block the page.

    Any no, you've never done anything so new and awesome with these tired HTML tags that is just so mind-blowing that it has to stay a secret so nobody steeeelz. : ) You get 93 tags? See if you can make something unique with those that nobody else has ever done it : )

    In worst case, if it's that thooper thecret, it prolly shouldn't be hangin out like a hooker on teh public intarwebz.
     
    Stomme poes, Oct 4, 2008 IP
  16. garrettheel

    garrettheel Peon

    Messages:
    341
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Elegantly put :D

    Basically, anyone with half a brain can get around any restrictions you can place on them. Also, from a usability point of view, the hit is too big for it to be worth it. Just going to have to accept that people can see your html no matter what
     
    garrettheel, Oct 4, 2008 IP
  17. GreatWebSuccess

    GreatWebSuccess Peon

    Messages:
    226
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #17
    No matter what type of javascript or restrictions you place in your code... even if you "encrypt" it it'll still be viewed by someone who wants to view it.

    Trust me, there's really nothing that you will have come up with that nobody else has seen before, it's just how you design and code your page that will stand out.
     
    GreatWebSuccess, Oct 4, 2008 IP
  18. FreelancerDon

    FreelancerDon Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Actually Gary I was out looking for this when I came across this post. I have a reason to hide the source ( maybe I am just a jaded person that doesn't trust people BUT )
    As a freelancer I have from time to time an opportunity to set up a demo for someone let them see it then have the buy it
    However if a smart user just steals all my code and work by doing a view source and copy/past well I get screwed
    So as you see there are from time to time a reason to hide the source code

    Thanks

    Don
     
    FreelancerDon, Apr 10, 2010 IP
  19. IanT

    IanT Well-Known Member

    Messages:
    503
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #19
    i think id send them a video of the site being used in order to prevent them from seeing the source, as opposed to the actual page.... this way they can SEE what it does, they just wont be able to try it until they buy it :)
     
    IanT, Apr 10, 2010 IP
  20. FreelancerDon

    FreelancerDon Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Ya know that is not a bad idea
     
    FreelancerDon, Apr 10, 2010 IP