Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Lolu chungechunge lwabekwa kunqolobane. Uyacelwa ubuze umbuzo omusha uma udinga usizo.

History management problem, specifically with window.history.go (-1)

  • 5 uphendule
  • 1 inale nkinga
  • 27 views
  • Igcine ukuphendulwa ngu jscher2000

more options

An application publishes a page "#1" on which the user clicks on the button. The application prepares an html (say "DOCUMENT.html") on an IFS, then publishes the page "LOADER" - as in figure A - with the URI of the prepared file. "DOCUMENT.html" then is loaded and in turn contains the instructions of figure B. When it is closed the control should return to the "LOADER" which in turn closes returning to page "#1". This works regularly the first time but, if the process is repeated, the return is the page "# 0" and if it is repeated again it goes even further back. What's wrong ? Keep in mind that the whole application uses jQuery and that other browsers (IE, Edge, Chrome) do not have this issue and always they return to page "# 1" Thanks Roberto

Ama-screenshot ananyekiwe

All Replies (5)

more options

I'm not entirely sure what issue you are having. The code that you have posted appears to work fine for me, unless I'm not entirely understanding what behaviour you are expecting.

When I open the LOADER file, it will create a new popup window with the DOCUMENT file loaded. According to your code in figure A, that's the behaviour I assume you were going for.

When I click one of the cells, another popup window opens without the toolbar and loads the file. According to your code, that appears to be the behaviour that you were looking for.

But perhaps I'm not sure what you are trying to accomplish here. Because you are opening a new window to display the DOCUMENT file, the window.history.go(-1) code is pointless since there is no history for that window to go back to.

The code you have posted works identical on Firefox, Google Chrome and Internet Explorer.

You could try changing window.history.go(-1) to the preferred window.history.back(), but the behaviour will likely remain unchanged.

Okulungisiwe ngu Wesley Branton

more options

I thank you very much for your promptness in answering to my issue, but evidently I did not explain the problem clearly. So I decided to make a short (2:43) scratch video to show the different behaviour of Firefox from other browsers. If you want you can see it at https://www.screencast.com/t/Zq7ZXhJ9M2M and then give me some advices about possible solutions. Thank you again. Roberto

more options

Hi Roberto, thank you for the video.

Why are you using window.history.go(-1) at all??

If you have a problem with unwanted link navigation/form submission, try using return false; to cancel that. I think you could do that in place of your history navigation, or you can add it to your onclick handler. For example:

<a href="p1.html" onclick="doIt(this); return false;">p1</a>

As for why Firefox is different from Chrome, I'm not sure. When you went forward to your results page, it seems that navigation is being ignored for purposes of window.history.go(-1) and so -1 starts from the previous page. However, it would be useful to get a simplified demonstration page to better compare the behavior.

more options

I don't want to bore you but I have to explain that the html of the attached figure is a dynamic script created by the application in the face of different requests. In many programs, when it is necessary to bring any document to the screen, the application searches for (or creates) the requested document, sets it aside and then creates and publishes the LOADER with the window.open instruction set each time with the reference. Reading the forum I thought that Cache-control could create different behavior, but doing different tests with or without META I didn't solve the difference. Many thanks, however, for your kind solicitude, which I greatly appreciate. Best regards. Roberto

more options

Is Relazioni the popup window? What window is Documento?

It would be helpful to have a simplified test case to work with.

Meanwhile:

You might want to force the toolbar on in popups so you can compare the back/forward history between the different requests (where Firefox ends up in the stack, or whether any entries are missing that you expect):

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button promising to be careful or accepting the risk.

(2) In the search box above the list, type or paste toolb and pause while the list is filtered

(3) Double-click the dom.disable_window_open_feature.toolbar preference to switch the value from false to true