3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

history.backを使わないで戻るボタンを作成する

Posted at

##はじめに
history.backを使用して「戻る」ボタンを実装していたが、firefoxでセッションエラーになってしまうため別の方法で戻るボタンを実装したい。

##解決策
リファラ情報を取得して実装する

var ref = document.referrer;

ブラウザの閲覧履歴を取得:history.back
直前に閲覧していたページを取得:document.referrer
とのこと

##実装

戻るボタン
<a href="##" onClick="go_back();"><b>戻る</b></a>
処理
    function go_back(){
        var ref_tmp = document.referrer; 

        DF = document.form1;
        DF.action = ref;
        DF.submit();
    }
3
4
1

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
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?