Skip to content Skip to sidebar Skip to footer

Get Back To Previous Page

just i want to make back button in my site. once i click the button it need to take the url in to previous page. how can i make this using jquery?

Solution 1:

<button type="button" onclick="history.back();">Back</button>

Solution 2:

the answer by wRAR is correct, you can use history.back or history.go(-1). However, if you are using ajax, you might need a bit more than that.

Stephen Walter has a nice article on how to use jQuery, ASP.NET, and Browser History which basically describes how to save and restore the application state yourself. I recommend you give a read.

Elijah Manor(co-host of the Official jQuery Podcast) has also written a nice article about this topic.

I hope this helps -D

Solution 3:

Try this: am using materialise css.

<buttonid="back_btn"class="btn waves-effect waves-light"name="action">Back<iclass="material-icons left">chevron_left</i></button>

In your jquery script file add

$("#back_btn").click(function (){
  window.history.back();
});

within the document ready function.

Solution 4:

For JQM, this works!

$(document).ready(function(){
    $('.backLink').click(function(){
        parent.history.back();
        returnfalse;
    });
});

Solution 5:

This is what I have successfully used in one of my recent projects:

<script>functiongoBack() {
       window.history.back();
    }
</script><ahref="#"onclick="goBack()"class="btn-event-show-video">
     Return to Stand
</a>

Post a Comment for "Get Back To Previous Page"