Thursday 8 May 2014

Disabling Right Mouse Click Using jQuery

If you are to disable right click on your web browser, you can use the following piece of code:



$(document).ready(function(){
$(document).bind("contextmenu",function(e){
return false;
});
});

Determine Browser


Suppose you were to determine the browser type of the browser currently in use. You can use the following piece of code to do this:


$(document).ready(function() {
// If the browser type if Mozilla Firefox
if ($.browser.mozilla && $.browser.version >= "1.8" ){
// some code
}
// If the browser type is Opera
if( $.browser.opera)
{
// some code
}
// If the web browser type is Safari
if( $.browser.safari )
{
// some code
}
// If the web browser type is Chrome
if( $.browser.chrome)
{
// some code
}
// If the web browser type is Internet Explorer
if ($.browser.msie && $.browser.version 6)
{
// some code
}
});


Disabling Right Mouse Click Using jQuery