How to disable CTRL + U and F12 Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
3 posters

    How to disable CTRL + U and F12

    erchima
    erchima
    Forumember


    Female Posts : 627
    Reputation : 15
    Language : INDONESIAN | Lua Script | Visual Basic | and Coding
    Location : Under your bed xD

    Solved How to disable CTRL + U and F12

    Post by erchima December 1st 2013, 4:03 pm

    How to disable CTRL + U and F12
    so that other people can not steal the code from the forum xD
    and how do I order if someone else pressed CTRL + U or F12, then they will be taken to the redirect link?
    Ultron's Vision
    Ultron's Vision
    Forumember


    Male Posts : 631
    Reputation : 45
    Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
    Location : Vienna, Austria

    Solved Re: How to disable CTRL + U and F12

    Post by Ultron's Vision December 1st 2013, 4:57 pm

    Rather than giving an overly elaborate answer, I'll give you the short answer.
    It's not possible.
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to disable CTRL + U and F12

    Post by Ange Tuteur December 1st 2013, 5:38 pm

    To add to Ultron's post,

    While you can disable people from viewing your source, you can never really stop it completely. Simply put, I could disable the script you have running which prevents such, or prevent the page from creating further alerts.

    I'd recommend against doing such as if you need support regarding the coding of your forum, I will most likely need to inspect your DOM to solve your issue. If you prevent us from viewing your source, It only makes it harder on us.
    erchima
    erchima
    Forumember


    Female Posts : 627
    Reputation : 15
    Language : INDONESIAN | Lua Script | Visual Basic | and Coding
    Location : Under your bed xD

    Solved Re: How to disable CTRL + U and F12

    Post by erchima December 1st 2013, 6:03 pm

    Ultron's Vision wrote:Rather than giving an overly elaborate answer, I'll give you the short answer.
    It's not possible.
    lol xD
    SethC1995 wrote:To add to Ultron's post,

    While you can disable people from viewing your source, you can never really stop it completely. Simply put, I could disable the script you have running which prevents such, or prevent the page from creating further alerts.

    I'd recommend against doing such as if you need support regarding the coding of your forum, I will most likely need to inspect your DOM to solve your issue. If you prevent us from viewing your source, It only makes it harder on us.
    well if so Very Happy
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to disable CTRL + U and F12

    Post by Ange Tuteur December 1st 2013, 6:13 pm

    Is this solved?
    Ultron's Vision
    Ultron's Vision
    Forumember


    Male Posts : 631
    Reputation : 45
    Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
    Location : Vienna, Austria

    Solved Re: How to disable CTRL + U and F12

    Post by Ultron's Vision December 1st 2013, 6:18 pm

    Just to demonstrate a rather complex script that disables Ctrl+U and F12 as well as right clicks if the browser allows it.

    Uses jQuery for simplicity. I don't want to implement all the error handling and compability issue fixes.

    Code:
    // attempt to prevent code from being seen if browser lets us do so
    var disabledKeys = [123,"17,85"];
    $(document).keydown(function(e){
    if(e.keyCode==disabledKeys[0]||e.keyCode.toString()==disabledKeys[1]) {
     alert("Code inspection has been disabled.");
     return false;
    }
    });
    $(document).mousedown(function(e){
     alert("Right-clicking disabled. Code inspection not permitted.");
     return false;
    });
    $(document).on("contextmenu",function(e){
     alert("Context menu disabled. Code inspection not permitted.");
    });
    Be aware that this is very, very, VERY frowned upon and will usually not contribute towards a good site's rating. Use at your own risk.
    erchima
    erchima
    Forumember


    Female Posts : 627
    Reputation : 15
    Language : INDONESIAN | Lua Script | Visual Basic | and Coding
    Location : Under your bed xD

    Solved Re: How to disable CTRL + U and F12

    Post by erchima December 1st 2013, 6:25 pm

    SethC1995 wrote:Is this solved?
    waiting hehe Very Happy  because i not use in forumotion but on blogger.com Very Happy 

    Ultron's Vision wrote:Just to demonstrate a rather complex script that disables Ctrl+U and F12 as well as right clicks if the browser allows it.

    Uses jQuery for simplicity. I don't want to implement all the error handling and compability issue fixes.

    Code:
    // attempt to prevent code from being seen if browser lets us do so
    var disabledKeys = [123,"17,85"];
    $(document).keydown(function(e){
    if(e.keyCode==disabledKeys[0]||e.keyCode.toString()==disabledKeys[1]) {
     alert("Code inspection has been disabled.");
     return false;
    }
    });
    $(document).mousedown(function(e){
     alert("Right-clicking disabled. Code inspection not permitted.");
     return false;
    });
    $(document).on("contextmenu",function(e){
     alert("Context menu disabled. Code inspection not permitted.");
    });
    Be aware that this is very, very, VERY frowned upon and will usually not contribute towards a good site's rating. Use at your own risk.
    thank you solved
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to disable CTRL + U and F12

    Post by Ange Tuteur December 1st 2013, 6:26 pm

    Topic solved and archived