Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Internet Explorer differs from the expected functionality on a back button

In my ASP.NET MVC project, we have introduced Lucine Searching, (Though in this context these details are not required, just giving some background, because I believe my issue has something to do with IE browser and caching).

In this page the user can filter their search based on a keyword. And the user can click to go to the listed out items and come back to the same page with the browser back button or a manual HTML button which has the javascript code, onclick = "location.href = 'Javascript:history.go(-1);'" ).

In Chrome, Firefox and even in Internet explorer 9, user gets back the page where he left off without any issues. I meant it keeps the value the user entered.

However both in IE 10 and IE 11 when the user clicks on the filtered list item it goes into the page and when user clicks either on the browser back button or HTML back button first time I get back the correct filtered page. However when the user again clicks on any of the item, and do the same procedure, I will not get back the filtered value. Instead with all the results, even the text box will not have the keyword entered by the user.

It is always assumes that the back button is there to help the people get back the same page and state where they left. I left with out any clue why IE 10 and 11 acts differently. Could any of you please help me to figure out what I am missing here.

like image 455
TBA Avatar asked Jan 08 '14 14:01

TBA


People also ask

Why does the Back button not work on some websites?

If the back button is gray or non-responsive, it is more than likely that you are in a new window. Or, if you can see that there are more tabs than there were previously, a new one was opened. To get back to your previous window, close the new tab, or click the earlier tab, located to the left of the new one.

How do I get the Back button on Internet Explorer?

In all browsers, the shortcut key combination for the back button is Alt + Left arrow key. Also, the backspace key works in many browser to go back. If you want to return to the page you came back from you can use the forward button after using the back button.

Will IE disappear?

Internet Explorer (IE) 11 is the last major version of Internet Explorer. On June 15, 2022, the Internet Explorer 11 desktop application is no longer be supported on certain versions of Windows 10*. Customers are encouraged to move to Microsoft Edge, which provides support for legacy and modern websites and apps.


1 Answers

In special cases (where just the url of the page can not determine state - because of some internal in-page dynamic functionality), We need to implement the history handling for ourselves.

Setting History tokens – Whenever the user takes an action that changes the “screen” in a way that you want to save, you should store a token

  • History.newItem("someLinkTarget", false);
  • Responding to History tokens

Whenever the URL ends in #someToken, that token is passed to the onValueChange method of the History’s ValueChangeHandler

public void onValueChange (ValueChangeEvent<String> event) {
String linkTarget = event.getValue();
if (checkForYourSavedToken(linkTarget)) {
... your code displays your expected results;
} else { … }

This knowledge is from GWT reading though, I did not test this at its core. Please ignore if this does not help you anyway. (Also please find w3schools which suggests that There is no public standard that applies to the history object, but all major browsers support it.

like image 83
Siva Tumma Avatar answered Oct 10 '22 10:10

Siva Tumma