I have a JQuery file that gets loaded when the page is loaded. The very first line is:
window.history.forward(1);
Later in the file, there are Ajax calls that I’d like to disable if the forward command is going to prevent the page from loading (preventing a back button load).
The Ajax calls actually fail in this situation (Chrome reports the error, IE and Firefox don’t but they do make the callback). Is there a way that I can get the status of the “forward” call and use it to gate the other calls?
One way you could detect whether the forward call did anything is to just check the URL before/after.
In other words, you could do something like: