Question: I have an MVC 4 app that contains a View where the user can enter search criteria (in a form) and then displays results in a table below the search form. For each row in the table, the user can click on a link that loads another View that shows him/her details about the item selected.

On this details view, I have a link that takes the user back to the from he/she can from using the following: `@Html.ActionLink("Back to List", "Index")`. When the user clicks this link and returns to the search form, all the search criteria he/she entered is gone. However, if the user clicks the Back button on the browser, the search criteria is maintained. Is there a way I can call ActionLink that mimics what the Back button is doing? Or maybe JavaScript? I am very new to MVC and JavaScript.

Answer: 
The easiest way is to use javascript [history API](https://developer.mozilla.org/en/docs/DOM/Manipulating_the_browser_history): 

```
window.history.back();

```

[here](http://jsfiddle.net/QKreA/) is the fiddle
Here a HtmlHelper extension that does the trick.

```
public static class Helpers
{
    public static MvcHtmlString BackViaHistory(this HtmlHelper helper, string linkText)
    {
        return new MvcHtmlString("<a onclick='javascript: window.history.back();'>" + linkText + "</a>");
    }
}

```