LoginSignup
22
24

More than 5 years have passed since last update.

スマホのブラウザバックでページをリロードさせる。

Posted at

ブラウザバックしたときに初期化した状態で画面表示したい。
そんなときはこれ入れとくと幸せになれる。

noBrowserBack
ContentObj.setEventBrowswerBack = function() {
    window.onpageshow = function() {
        if (event.persisted) {
            location.reload();
        }
    };
};


// イベントセット
ContentObj.setEventBrowswerBack();

// ----------------- 参考URL
http://nmi.jp/archives/273

22
24
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
24