Continuous display of a wait cursor during transitions on an HTML web page

Having a standard ASP.Net/MVC application, I am faced with what seems like a fundamental question that has no clear solution.

Common situation:
When a user navigates through an HTML page by pressing a button, the following typically occurs:

  1. The old page remains in the browser for 1-2 seconds.
  2. The entire browser window turns white for 1-2 seconds.
  3. The browser takes X seconds to load the new page.

My basic requirement is to ensure that the user sees a wait or progress cursor throughout all these steps. Despite spending hours trying, I have been unable to achieve this.

1: It is possible to use CSS to set a wait cursor when the user navigates (e.g. by pressing a link or button) like:

$('*').css('cursor', 'wait !important')

This works somewhat during phase (1).

2+3: However, my attempts to set a wait cursor during phases (2) and (3) have only resulted in a brief flicker at the end of phase (3), which is not helpful for the user.

The ideal scenario would be to set a wait cursor on the browser itself at the beginning of phase (1) and switch back to the default cursor at the end of phase (3) (e.g. in the Document Ready event).

I welcome any input! Many others must have encountered this issue before!

PS. While the browser provides a small wait symbol in the active tab during page transitions, it may not be prominent enough for users. They need a visible wait symbol exactly where they clicked the navigation button to avoid confusion. Otherwise, users might think the webpage is unresponsive.

Answer №1

For my preference, I find it effective to use the wait cursor by implementing the following code:

$(window).on('beforeunload', function() {
    $('*').css('cursor', 'wait !important')
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Strange outcomes observed with CSS Selector nth-child

When utilizing the CSS nth-child selector, I am encountering some peculiar issues. The HTML structure is as follows: <div class="block feature-callout-c" id="overview"> <div class="row"> <div class="span twelve"> ...

Mysterious issue with jQuery $.ajax: server returns 200 OK but no error messages displayed

I am feeling completely overwhelmed by this issue. I am using simple jQuery ajax calls to retrieve values from a database and populate select elements with the obtained JSON data. It seems to work fine in most browsers on my end, but the client has reporte ...

Tips for effectively locating code within a web browser's code base

Struggling as a new programmer in a new job with a fresh codebase, I am finding it difficult to connect the code to the webpage I am currently on. What methods can I use to locate the relevant HTML in the codebase that is being rendered in the web browser? ...

What is the process for using npm in conjunction with index.js and index.html?

Is it feasible to launch an application using npm without incorporating express? I have a simple setup with just one script file and one html file. Many resources mention adding node.js alongside express, but I am looking for an alternative method. My des ...

Troubleshooting Vue.js rendering problems on Safari_BROWSER

I'm encountering a strange issue with my portfolio website, which is built using Vue and Laravel. The problem arises specifically in Safari - the project thumbnails don't display until the browser window is resized. Here's the relevant code ...

Adding an object to a scene in Three.js

I've been experimenting with a code example I found online and my goal is to incorporate a textured cube into the project while specifying its position. However, despite my efforts, the cube doesn't seem to be showing up. Here's what I have ...

The error message "TypeError: Router.use() expects a middleware function, but received a [type of function]" is a common occurrence in FeathersJS

Struggling to bind a method to my /userAuthenticationInfo route, I've made several adjustments in my code based on other posts related to this issue but still unable to make it work. I am using feathersJS's express implementation, and even with e ...

The art of positioning Bootstrap popovers

Does anyone know a way to position a bootstrap popover on the "Right Bottom" of a clicked button instead of the "Right Middle"? The positioning should be dynamic. https://i.sstatic.net/OSQln.png To see the standard code, click here: http://jsfiddle.net/V ...

Having trouble getting my Leaflet map to display even after meticulously following the quick-start guide

I am experiencing an issue where the map is not displaying at all, leaving a blank space where it should be. Despite following Leaflet's quick-start guide, I have been unable to determine the cause of this problem. Here is the code that I currently h ...

transmitting a collection of objects to an MVC4 controller using either $http or $.ajax

I'm really struggling with this issue and can't seem to figure out what I'm doing wrong. I've tried everything. Originally, I was attempting to send an array of objects to an ASP.NET MVC controller using Angular's $http, but it ju ...

Using a constructor function in a for loop

Currently, I am learning how to build a Blackjack game with Javascript on Codecademy. I'm struggling to figure out what code to write inside the for-loop. The task at hand is to create a "score" method within the Hand constructor. This method should ...

Automated tasks running on Firebase Cloud Functions with cron scheduling

There are two cloud functions in use: The first cloud function is used to set or update an existing scheduled job The second one is for canceling an existing scheduled job The management of scheduling jobs is done using import * as schedule from &ap ...

Listening for keypress events on a div element using React

I'm currently struggling with implementing a keypress listener on a component. My goal is to have my listener activated whenever the "ESC" key is pressed, but I can't seem to figure it out. The function component I am working with is quite stra ...

Deciphering the structure of CSS, & and + symbols

Exploring this selector in a .css file: .tab { flex: 1 0 auto; height: 52px; & + & { border-left: 1px solid; } } I'm unsure about the meaning of & + & {} in this context - can someone provide clarification? ...

Navigating on the horizontal axis within a container with overflow properties

I am trying to insert multiple children-divs into a parent-div. The parent div has a fixed width. The children are set to float left and will overflow the container. I need the ability to scroll along the x-axis. However, when I attempt to do this, the c ...

Using ASP.NET MVC to Accept JSON in an Action as an Anonymous Object

When making a POST Ajax request to a controller action with JSON data, it is important to consider the data structure. Here is an example of how the request might look: $.ajax({ type: "POST", url: "/AssembleProducts/UpdateProduct", data: JSON. ...

Building an MVC 5 Application with Jquery ajax: Utilizing data annotation for passing a selection ID of -1

Below is my front end Jquery script: //Json String JSON.stringify({ Id: CurrentID, CustomerId: $.trim($("#CustomerList").val()), StoreId: $.trim($("#StoreList").val()), ProductId: $.trim($("#ProductList").val()), Date: $.trim($("txtDa ...

How to position a particle at the center of the visible screen using Three.js

I have a unique scenario in which I am using a ParticleSystem with thousands of particles spread across the screen. When zooming and panning using the OrbitControls, I am looking to identify the particle closest to the center of the visible area. There ar ...

What is the best way to combine the tweet counts from 2 different URLs using jQuery?

Is there a way to sum up the tweet numbers from two different URLs? My blog post is divided into multiple pages and users may tweet from different URLs (such as Page1 or Page2): For example: http://mydomain.com/article/page/1.html http://mydomain.com/ar ...

What are the steps to incorporate recursion into a data comparison function?

I have a function in my application that helps me identify the changes between new data and old data. I am looking to refactor my getChanges function so that a particular test can pass successfully. I believe making this function recursive might be necess ...