disallow window open in javascript

后端 未结 2 1015
深忆病人
深忆病人 2021-01-05 06:40

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

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-05 07:37

    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');
    } 
    

提交回复
热议问题