Have JS Office Add-in close or exit events for the

2019-09-02 02:23发布

I'm currently develop a JS Office Add-in, but I could'n find any reference in API Documentation (https://dev.office.com/reference/add-ins/) for an close document or exit document event. I need to suscribe it to show the user warning message about save plugin settings

2条回答
太酷不给撩
2楼-- · 2019-09-02 02:48

There are no events like that in the current version of the Add-in API.

查看更多
爷、活的狠高调
3楼-- · 2019-09-02 02:49

Try this code:

window.addEventListener("beforeunload", function (e) {
     var confirmationMessage = "\o/";
     (e || window.event).returnValue = confirmationMessage; //Gecko+IE
     return confirmationMessage;                            //Webkit,Safari,Chrome
});
查看更多
登录 后发表回答