简体   繁体   English

使用javascript捕获新的浏览器窗口打开事件

[英]Capture new browser window open event with javascript

is it possible to capture new browser window open event with javascriptand call some functions before? 是否可以使用javascriptand之前调用某些函数来捕获新的浏览器窗口打开事件? Thanks 谢谢

window doesn't have a beforeload event. window没有beforeload事件。

Something like this could work, but keep in mind that overriding window.open is pretty dangerous. 像这样的东西可以工作,但请记住,重写window.open是非常危险的。

var windowOpen = window.open;

window.open = function(url, name, features, replace) {
    alert("opening a window");
    // do other stuff here
    windowOpen(url, name, features, replace);  
}

window.open("http://www.google.com");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM