I’m developing a website using .NET MVC, which can be accessed at https://gengecmimarlik.com . The site uses a page loader animation that works as expected during normal navigation through the navbar links. However, I encounter an issue when using the browser’s back button.
Problem:
When I navigate to a different page (e.g., /TumProjeler or /iletisim) and then press the back button on the browser (Chrome or Edge), the loader animation appears but stays stuck, preventing the page from loading properly. The site doesn’t crash or throw any errors, but the loader does not disappear, and the page content doesn’t show up.
If I remove the preloader, the problem disappears, but I need to keep it for design purposes.
Key Details:
- I’m not using any AJAX calls for page transitions; the navigation is
straightforward. - All routes and navigation links are configured properly.
- Here is a sample of how the links are set up in the navbar:
<a class="rd-nav-link" asp-controller="Home" asp-action="Index">Ana Sayfa</a>
<a class="rd-nav-link" asp-controller="Home" asp-action="AllProjects">Tüm Projeler</a>
<a class="rd-nav-link" href="@Url.Action("Index", "Home")#ekibimiz">Ekibimiz</a>
<a class="rd-nav-link" asp-controller="Home" asp-action="Contact">İletişim</a>
- I’m using a preloader that runs when the page loads. However, it
seems to get stuck when navigating back using the browser’s back
button.
What could be causing the page loader to get stuck when the back button is pressed? Are there specific .NET MVC behaviors or browser caching settings that I need to adjust? How can I ensure that the loader doesn’t hang and the content loads properly when users go back to the previous page?
Any advice or suggestions would be greatly appreciated. Thank you!