Disable new tab opening of links using JQuery

Below JS function will use for disabling the new tab functionality and it will throw the alert message.


function disableNewTabClick() {
    var listCtrl = document.getElementsByTagName('a');
    for (var i = 0; i < listCtrl.length; i++) {
        listCtrl[i].onmousedown = function (event) {
            if (!event) event = window.event;
            if (event.ctrlKey) {
                alert("Functionality for Opening links in a new tab/window is disabled !");
                return false;
            } if (event.shiftKey) {
                alert("Functionality for Opening links in a new tab/window is disabled !");
                return false;
            } if (event.shiftKey && event.ctrlKey) {
                alert("Functionality for Opening links in a new tab/window is disabled !"); 
                return false;
            }
        }
    }
Ebook Download
View all
Learn
View all