
這時候只要用javascript的beforeunload就可以了。
- $(window).bind("beforeunload", function(e) {
- return '你還沒儲存,你確定要離開嗎?';
- });
只要觸發以下的事件就會出現對話視窗:click,document write,document open,document close,window close ,window navigate ,window NavigateAndFind,location replace,location reload,form submit.
Demo
0 意見:
張貼留言