概要
JavaScriptのHistory APIでブラウザの戻るボタンを無効化することができる。
サンプル
window.history.pushState(null, null, null);
window.addEventListener("popstate", function() {
  window.history.pushState(null, null, null);
  return;
});処理内容の説明
- window.history.pushState(null, null, null);
 履歴の先頭にnull(自分自身)を追加。
- window.addEventListener("popstate", イベントハンドラ);
 戻るボタンが押されたらイベントハンドラが実行される。
 
  
  
  
  
コメント