Firefox extension: window activate/deactive event

前端 未结 2 1506
予麋鹿
予麋鹿 2021-01-28 03:38

in my Firefox extension I try to handle the event when the browser window is activated or deactivated. Adding the events \"activate\" and \"deactivate\" to the window does basic

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-28 04:39

    If I understand you correctly, you can use this:

    window.addEventListener("blur",function(){
     //mystuff
     },false);
    

    and this:

        window.addEventListener("focus",function(){
        //mystuff
        },false);
    

提交回复
热议问题