prevent user to "view Source" from Internet Explorer

Discussion in 'Windows Desktop Systems' started by jake123456789, May 14, 2003.

  1. I want Java source code to prevent internet explorer user click on second mouse and view resource.

    Can Someone email to me pls or post it over!

    Thanks you!
     
  2. Herkalees

    Herkalees Guest

    This disables right-click entirely.


    PUt this in the body tag…


    <script language=JavaScript>
    <!--

    //Disable right mouse click Script
    //By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
    //For full source code, visit http://www.dynamicdrive.com

    var message="Function Disabled!";

    ///////////////////////////////////
    function clickIE4(){
    if (event.button==2){
    alert(message);
    return false;
    }
    }

    function clickNS4(e){
    if (document.layers||document.getElementById&&!document.all){
    if (e.which==2||e.which==3){
    alert(message);
    return false;
    }
    }
    }

    if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS4;
    }
    else if (document.all&&!document.getElementById){
    document.onmousedown=clickIE4;
    }

    document.oncontextmenu=new Function("alert(message);return false")

    // -->
    </script>
     
  3. yoyo

    yoyo _________________

    Messages:
    1,557
    ..and do you think someone interested in your source code doesn't know how to disable javascript?:p
     
  4. drahzar

    drahzar Guest

    they can always just go to view source in the menu
     
  5. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    Heh, I was going to write what yoyo and drahzar have posted above me.

    It is, absolutely, 100%, impossible to hide your source code.
    Because basically, that source gets sent to the browser, without it there's is nothing to render, and once your source is at the user end there are multple ways of viewing it.

    For example, turn javascript off, use a different browser, put the URL into a download manager then open it with notepad, put the URL into the open dialog of something like frontpage, find the cached version of the page and open it up, and so on.
     
  6. sboulema

    sboulema Moderator

    Messages:
    2,846
    Location:
    Amstelveen, The Netherlands
    why do you website makers are so pinned on protecting our sourcecode. i find it very annoying when sites do that cause i cant use my mouse gestures on that kinda sites
     
  7. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    I hate it as well, if someone wants to rip my sites source they can do so if they wish. Ill just kill them if i find my desing on another site.

    Mozilla still pops the window up even if that message comes so right click still works ;).