beforeunload
beforeunloadはHTML5で定義されたページから離れる際に警告をだす為のメソッドです。
windowオブジェクトに対してaddEventListenerイベントをバインドを行います。イベントハンドラー内では警告時に表示するテキストを返り値で設定することができます。
window.addEventListener("beforeunload", function() {
return "ページを離れますか?";
}, false);
登録日 : 2013年06月22日 最終更新日 : 2013年6月22日
同じカテゴリー(Event)のエントリー
- beforeunload
- unload
- pointercancel
- pointerhover
- mouseout
- pointerout
- mouseover
- pointerover
- pointerup
- pointermove
- pointerdown
- gestureend
- gesturechange
- gesturestart
- touchcancel
- devicemotion
- popState
- hashchange
- pagehide
- pageshow
- error
- orientationchange
- touchmove
- touchend
- touchstart
- MutationObserver
- DOMNodeInserted