How can I disable window.open()
using html, javascript, jQuery...?
I mean block any window open attempt, making \"not-working\" all existing window.open() f
//for iframes:
$.each($('iframe'), function() {
this.contentWindow.open = function (url, windowName, windowFeatures) {
//iframe window.open caught!
};
});
//for window:
window.open = function (url, windowName, windowFeatures) {
//window.open caught!
};
You'd be polluting the global namespace, but you could simply override the window.open
method...
window.open = function (url, windowName, windowFeatures) {
console.log('not opening a window');
}