Why Internet Explorer is different from the expected functionality on the back button

In my ASP.NET MVC project, we implemented Lucine search (although this data is not required in this context, just giving some background, because I believe that my problem has something to do with IE browser and caching).

On this page, the user can filter his search by keyword. And the user can click to go to the listed items and return to the same page using the browser button or the manual HTML button, which has javascript code, onclick = "location.href = 'Javascript:history.go(-1);'" ).

In Chrome, Firefox, and even Internet Explorer 9, the user returns the page that he stopped at without any problems. I meant that it saves the value entered by the user.

However, in both IE 10 and IE 11, when a user clicks on a filtered list item, he goes to the page, and when the user clicks the back back button or back back button, I first return the correct filtered page. However, when the user clicks on any item again and performs the same procedure, I will not return the filtered value. Instead, all text fields will not have a keyword entered by the user.

It is always assumed that the "Back" button is designed to help people return to the same page and indicate where they went. I left without a clue why IE 10 and 11 act differently. Can any of you please help me figure out what I don't see here.

+7
javascript browser internet-explorer asp.net-mvc browser-cache
source share
2 answers

In special cases (when only the page URL cannot determine the state - due to some internal dynamic functions inside the page), we need to implement history processing for ourselves.

Fixing history notes - every time the user takes an action that changes the β€œscreen” in the way that you want to save, you must store the token

  • History.newItem("someLinkTarget", false);
  • Reply to History Tokens

Whenever the URL ends with #someToken , this token is passed to the onValueChange method of the onValueChange History

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

This is knowledge from GWT reading, although I have not tested it at its core. Please ignore if this still does not help you. (Also find w3schools , which assumes that there is no public standard that applies to the history object, but all major browsers support it.

+2
source share

If you use ajax inside the page, and then go away and go back, the ajax state will be lost. The page does not save any changes made after loading when you click forward or backward.

This is not entirely true. Forms are saved, and I have used this trick in the past.

The pages load and the user searches through ajax. Save the ajax response to hidden input. When the user leaves the page and returns, the script page detects that there is now content in the hidden input and processes it, displaying the results previously obtained to the user.

+1
source share

All Articles