关闭浏览器事件
Closing the browser event
我目前正在开发一个 firefox 扩展程序,我需要知道用户何时关闭浏览器,以便调用一个函数。我搜索了 firefox addon sdk 文档,但没有找到任何内容。我的问题有解决方案吗?
试过这个吗?
<script type="text/javascript">
$(document).ready(function(){
window.onbeforeunload = function() {
var msg =" If you're not interested please let us know what we can do to improve."
return msg;
} });
</script>
require("sdk/system/unload").when(function(reason) {
if (reason === 'shutdown') {
handleShutdown();
}
if (reason === 'disable') {
handleShutdown();
}
});
我目前正在开发一个 firefox 扩展程序,我需要知道用户何时关闭浏览器,以便调用一个函数。我搜索了 firefox addon sdk 文档,但没有找到任何内容。我的问题有解决方案吗?
试过这个吗?
<script type="text/javascript">
$(document).ready(function(){
window.onbeforeunload = function() {
var msg =" If you're not interested please let us know what we can do to improve."
return msg;
} });
</script>
require("sdk/system/unload").when(function(reason) {
if (reason === 'shutdown') {
handleShutdown();
}
if (reason === 'disable') {
handleShutdown();
}
});