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>

How to disable the F12 key with mouse right click operations in Web site running in the browser?


In this article I will explain How to disable the F12 key with mouse right click operations 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 not be accessing the F12 key with mouse right click options.

Below is JQuery code for disable F12 Key and Mouse Right click Options

<script>
$(document).keydown(function (event) {
if (event.keyCode == 123) {
return false;
}
else if (event.ctrlKey && event.shiftKey && event.keyCode == 73) {
return false;
}
});

$(document).on("contextmenu", function (e) {
e.preventDefault();
});
</script>

How to convert phone number format using JavaScript like international Format.

In this Article I will explain How to convert phone number format using JavaScript like international Format. For example USA format.  Convert phone number to international format (USA) in JavaScript / jQuery convert number to phone number format with example or JavaScript phone number validation example.

To convert number to phone number / international format in JavaScript we need to write the code like as shown below.

<script type="text/javascript">
function convertphoneNo() {
var phnumber = document.getElementById('txtPhoneNumbernumber').value;
var numbers = phnumber.replace(/\D/g, ''),
char = { 0: '(', 3: ') ', 6: ' - ' };
phnumber = '';
for (var i = 0; i < numbers.length; i++) {
phnumber += (char[i] || '') + numbers[i];
}
document.getElementById('lblResult').innerHTML = phnumber;
}
</script>

How to hide div elements on scroll position using jQuery?

In this article I will explain How to hide div elements on scroll position using jQuery? Or show hide div on scroll position in jQuery or show / hide element on scroll jQuery. In jQuery by using window. Scroll property we can show or hide div element based on position.

Below is the jQuery Script code:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
$(function () {
$(window).scroll(function () {
var scroll = $(window).scrollTop();
if (scroll >= 30) {
$('#divShow').hide()
$('#divHide').show()

}
else {
$('#divShow').show();
$('#divHide').hide()

}
});
})
</script>