Friday, September 11, 2009

Strange Behaviour of Browser Back button.


We have noticed strange behaviour of Browser back button while implementing new requests from our client of GroupIt learning Activity project.

This project is extensively using Ajax/javascript. Our client asked us to show the previous page with existing data when clicking "back" button.

So, we created a back button whose onclick event calls "history.go(-1)", which is same as clicking Back button in the browser.

This back button behaves differently in different browsers and in different servers.

i-e Existing data in previous page was NOT shown in Internet Explorer (IE).
But existing data was shown in FireFox in production server. The strange thing is, existing data was NOT shown in FireFox itself in our Test server.

We have faced lot of cross browser issues in our previous projects. But first time I am noticing different behavior of same browser (FireFox) in different Servers.

My understanding about browser back button is, it is purely depending on behaviour of the web browser. Since we are using same code in our Test server and in the production server, the HTML rendered to the browser from both Test server and production server should be ideally same.

Just wondering why same browser is behaving differently when getting HTML from different webservers.

By searching internet I came to know that the factors affecting the behaviour of Browser back button are "cache control" and "expire" parameters which are set from either meta tag or from header method of php.

But in our case, since the code is same the header information should be same in both server.

Is there any other factor which controls behaviour of browser back button?


More Articles...

No comments:

Search This Blog