Category Archives: Preload Form

Browser ‘Back’ Button Mystery

Time for another post after long hiatus. It’s not like I didn’t have anything to share since last time I shared a post but all this time I did not struggle much with the problem until I got this one. So I named it as “Browser Back Button Mystery” and trust me It was a real mystery for me up until I found the solution to it.


One of our client reported a problem that whenever they fill the form with the required information and click on ‘Next’ button. They get to the next webpage with all the required calculations done based on the input and NOW when they hit browser ‘Back’ button, browser takes them to the previous page and all the data entered by the user is now lost. Users are frustrated because they have to enter all the information again. I assume here that users only needs to change few things on the full-page length form.

I also agree to the fact that relying on the browser back button to populate all the previous input values is not the right thing to do rather web application itself must have some ‘Back’ button for such purpose. Our client is reluctant to have such button on the web page. They also mentioned that this started to happen since we deployed an update to the portal recently.


I did the first thing first which is ‘Replicating the Issue’. Bang. I can replicate the issue in Internet Explorer (Yes, they are still using internet explorer). As I’m a chrome fan just like any other developer, I tried replicating this in Chrome and sadly as expected everything worked smoothly. Data was indeed populated. It was kind of mystery to me to see same thing behaving differently in different browser. I completely understand the fact all the browsers out there are written differently, hence, work differently. I always assumed that doesn’t matter which browser you use, basic functionality always remains the same and work the same way. Before blaming Internet explorer, I thought of giving this a go within Firefox and Safari, two other widely used browsers. It was working fine in Safari but not in Firefox. I knew why I got two groups here. This is because both Chrome and Safari are based on Web-kit whereas Internet Explorer and Firefox are not. All this investigation did nothing other than building more complex situation here.

After unsuccessful Googling and digging in StackOverflow forums, I thought there is some bug in Internet Explorer and Firefox which is causing this to happen but then I realized that Client mentioned something about the recent update to the portal.

So, I decided to compare two versions of the code, one before the update and other after the update. I couldn’t figure out anything that could have changed this behaviour. I also knew that this is working to perfection in Chrome and Safari, so code is not the problem. Situation got worse. No Idea what’s causing this strange thing to happen – Browser or the Code.


Then I had a kind of intuition that I should also match the references and specially their versions and Bang!!!!

“AjaxControlToolkit” was updated by NuGet to version 7.725.0 from 4.1.51116. This update has also added “AjaxMin” and “HtmlAgilityPack” as the new AjaxControlToolkit update is dependent on these two. When I updated these last time, I thought it will be by default support everything that version 4.1.51116 supports and will include more enhancements and fixes.

After realising that these reference libraries are updated, I rolled back to the version 4.1.51116 using the following command in Library Manager Console:

PM> Install-Package AjaxControlToolkit -Version 4.1.51116

The above command will fetch the specified version of the AjaxControlToolkit library from NuGet repository. This will also includes “AntiXSSLibrary”, “HtmlSanitizationLibrary” and “SanitizerProviders”.

Doing this resolved the issue and the Back button is working as expected back again. Everyone is happy but still I need to check change log of AjaxControlToolkit to see what’s been changed between versions.

Note: I still couldn’t figure out why the AjaxControlToolkit version 7.725.0 is not working as expected in Internet Explorer whereas version 4.1.51116 is working fine. I will always have some level of working expectation considering AjaxControlToolkit and Internet Explorer are both from Microsoft.

Tagged , , ,