Disabling the "view source" option?

Discussion in 'HTML & Website Design' started by thesamemanhal, May 21, 2009.

  1. #1
    Is there ANY way to disable the "View Source" options in the internet browsers?
    I know how to disable the right-click option but that is not what I want, the idea is to make it impossible (or at least make it as hard as possible) for a user to view your source codes ...
     
    thesamemanhal, May 21, 2009 IP
  2. SCLocal

    SCLocal Notable Member

    Messages:
    1,270
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    235
    #2
    Anyway you look at it you're going to be able to get the source, the browser has to read the source to display the webpage, right? So the browser needs to read the source. Your best option would be encoding the entire webpage code, similarly to what some people do to their footer to keep sponsored links intact.
     
    SCLocal, May 21, 2009 IP
  3. N2D

    N2D Peon

    Messages:
    198
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Use Javascript, Google it out.
     
    N2D, May 21, 2009 IP
  4. thesamemanhal

    thesamemanhal Active Member

    Messages:
    1,126
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    55
    #4
    Using Javascript !, how ?
     
    thesamemanhal, May 21, 2009 IP
  5. m0zart

    m0zart Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can dispel it simple by using javascript, it will block right-click with your mouse.
    - BUT! it is impossible to hide the view source code, because you can enter them by a browser-buttom or a simple script.
     
    m0zart, May 21, 2009 IP
  6. oxidati0n

    oxidati0n Peon

    Messages:
    744
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    View source is part of the public HTML render, which abdominently cannot be hidden no-matter what type of technology you seem to have implented.

    Even if browsers declined it, systematic technology can pull out the data and if it doesn't pull out the data then there won't be any HTML render to actually provide out. A long explanation, I know, but it's really hard to understand how you can in reality stop HTML source from not being accessible publically.

    My advice: if you've got something in your HTML to hide, use some sort of technology to stop it e.g. javascript or imagery rewrite (aka. GD library).
     
    oxidati0n, May 21, 2009 IP
  7. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #7
    You can use all the javascript you want but you still can't block viewing the source. Forget this idea.
     
    drhowarddrfine, May 21, 2009 IP
  8. Rad_Dev

    Rad_Dev Peon

    Messages:
    62
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    You can disable the entire context menu (right-click) with this little script.

    <SCRIPT language=JavaScript>
    var message="";
    ///////////////////////////////////
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if 
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers) 
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
    
    document.oncontextmenu=new Function("return false")
    // --> 
    </SCRIPT>
    Code (markup):
     
    Rad_Dev, May 21, 2009 IP
  9. coldfinga

    coldfinga Peon

    Messages:
    49
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Another thing you could do is encrypt your sourcecode to make it difficult to read.
     
    coldfinga, May 21, 2009 IP
  10. N2D

    N2D Peon

    Messages:
    198
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Thanks dude, now poster this is what i'm talkinq about.
     
    N2D, May 21, 2009 IP
  11. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #11
    So what? ctl-u = view source. Or View->Page Source.
     
    drhowarddrfine, May 21, 2009 IP
  12. thesamemanhal

    thesamemanhal Active Member

    Messages:
    1,126
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    55
    #12
    Thank you for this, in fact I knew how to disable the right-click but I was talking about the source code and if there is a way to make it difficult to be viewed publicly or at least make it hare to get it.
     
    thesamemanhal, May 21, 2009 IP
  13. N2D

    N2D Peon

    Messages:
    198
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    uhm! at last u gave d code, *thump up*
     
    N2D, May 21, 2009 IP
  14. Spawny

    Spawny Well-Known Member

    Messages:
    252
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #14
    forget it you cant stop visitors from viewing your source..
     
    Spawny, May 21, 2009 IP
  15. kashifmughal

    kashifmughal Member

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #15
    i've great experience after use this script too, i think this will be more helpful for others.
     
    kashifmughal, May 22, 2009 IP
  16. N2D

    N2D Peon

    Messages:
    198
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Hey dude, wat do u mean? i quess the script work prefectly. :rolleyes:
     
    N2D, May 22, 2009 IP
  17. oxidati0n

    oxidati0n Peon

    Messages:
    744
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #17
    It's pretty funny, but even more stupid how it actually doesn't occur to you that it has no use.
    Disabling right-click is just plain stupid, and yet, another annoyance. I leave sites with disabled right-click immediately.
     
    oxidati0n, May 22, 2009 IP
  18. tsquez

    tsquez Peon

    Messages:
    77
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #18
    yep its true if people want to see your source code you cant hide it - your wasting your time - but hey your effort right ;)
     
    tsquez, May 22, 2009 IP
  19. Rad_Dev

    Rad_Dev Peon

    Messages:
    62
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Sorry.. I misunderstood what you were looking for.
     
    Rad_Dev, May 22, 2009 IP
  20. Ralle

    Ralle Active Member

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #20
    People who are clever enough to understand and want to read your sourcecode can bypass anything. Simply disabling JavaScript in their browser will make you vulnerable. If you really wanna hide something, use flash. There is nothing you can do.
     
    Ralle, May 22, 2009 IP