CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Location
    Chennai, India
    Posts
    1,064

    Disable View Source

    Is there any way to hide users from seeing the source code?

    Madhivanan

  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Disable View Source

    yes- at least you can make it harder to see:
    serach for a function to "disable" right click (indeed it is a function that on
    right click show an alert...), and have your pages without menubar, title bar,...
    (serach for "window.open" and its options...)
    Then you should disable also the possibility of opening a new window from
    previous (see what happens when in Ie you press ctrl+n ?)

    example of disabling right click
    Code:
    <script language=JavaScript>
    <!--
    
    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>
    Code:
    example of opening windows
    window.open ("http://www.Codeguru.com","mywindow","status=1");
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Jul 2004
    Location
    Chennai, India
    Posts
    1,064

    Re: Disable View Source

    Thanks. I want to know how to disable tool bar.

    Madhivanan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured