3

I have a problem. I bind click events to my "a" tags which hides the contents of the page and shows a loading spinner (until the new page has loaded).

The problem of this approach is that when you click the back button of the browser, the browser recovers the last state of the previous page, where you can only see the loading spinner.

It isn't the same for every browser, but for example on an iPad with the latest Safari this is a problem.

An example of how my code looks like is this:

$("a").click(function() {
    showLoadingSpinner(".container", "loading new page...");
    // hides the div with the container class and 
    // shows the loading spinner with the text "loading new page..."
});

Maybe I have to somehow replace all of these requests with some kind of ajax request where I can hide the loading spinner after the request has been completed?

Edit: I am using ASP.net to build the website (no PHP). It's a really complicated and big application with lots of different types of ajax requests everywhere on the page.

Edit 2: Just to clarify, I'm talking about "a" tags with "href" attributes.

crowbar
  • 39
  • 3
  • Problem is when you click the link. The page stops and than starts to load the new page. The spinner really has no time to load.... – epascarello Sep 13 '18 at 19:36
  • You misunderstood. You can see the spinner, some of the pages take a few seconds to load (lots of database stuff going on, long story), its working fine. The problem is just when I press the back button on the browser im on the previous page, but the loading spinner is still there. – crowbar Sep 13 '18 at 21:40

0 Answers0