Reputation: 45
Suppose I have an application in which user searching an item & then search that item category , subcategory & availability in country. Or next he search another item "So now I want to set a button(See Previous result) & by clicking on them he checked all his previous searched result. " Same as all browser back button works.
So kindly suggest me how can I do that. Any suggestion really appreciate.
Upvotes: 3
Views: 97
Reputation: 1873
You can access browser history from javascript using history
object
window.history.back()
will bring you one step backward(previous page) and
window.history.forward()
can access next page from there.
length
will returns the number of URLs in the history list.
Example:
<script>
function goBack() {
window.history.back();
}
</script>
<input type="button" value="Back" onclick="goBack()">
Upvotes: 0
Reputation: 707
Please try this solution :
<script type="text/javascript">
function goBack()
{
window.history.back()
}
</script>
<input type="button" value="Back" onclick="goBack()">
The back() method loads the previous URL in the history list. This is the same as clicking the Back button or history.go(-1).
Upvotes: 1
Reputation: 3362
You can store value to browser sessions and reload the page if session have value then get from session or from your search result.
Upvotes: 0