Tuesday 17 May 2016

How to get prompt message while clicking the F12 key operation in Web site running in the browser?


In this article I will explain How to get prompt message while clicking the F12 key operation in Web site running in the browser? Using jQuery

As a Developer you can see the code in development time it’s OK for you, but when others are trying to see your application code and do some operations definitely we don't want to disclose this. So what is the solution? We can easily prevent this using some simple JavaScript and jQuery scripts.

Clients (or) Users will click the F12 Key they got prompt message like “He / She can’t the code”

Below is JQuery code for F12 Key prompt message code:

<script>
var checkStatus;

var element = new Image();
element.__defineGetter__('id', function () {
checkStatus = 'on';
});

setInterval(function () {
checkStatus = 'off';
console.log(element);
console.clear();
document.querySelector('#status').innerHTML = checkStatus;
}, 1000)
</script>


Total code for F12 Key prompt message code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Access The Code</title>
</head>
<body>
    status:
    <div id="status"></div>
    <script>
        var checkStatus;

        var element = new Image();
        element.__defineGetter__('id', function () {
            checkStatus = 'He / She access the code';
        });

        setInterval(function () {
            checkStatus = 'He / She not access the code';
            console.log(element);
            console.clear();
            document.querySelector('#status').innerHTML = checkStatus;
        }, 1000)
    </script>
</body>
</html>



No comments:

Post a Comment