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.
The forum of the forums
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 Sun 1 Dec - 15:03

    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 Sun 1 Dec - 15:57

    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 Sun 1 Dec - 16:38

    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 Sun 1 Dec - 17:03

    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 Sun 1 Dec - 17:13

    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 Sun 1 Dec - 17:18

    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 Sun 1 Dec - 17:25

    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 Sun 1 Dec - 17:26

    Topic solved and archived

      Current date/time is Wed 13 Nov - 17:31