Is there a document.readyState for SPA pages?

Is there a " document.readyState === 'complete' " type of thing for SPA pages?

Basically, I am asking if there is a way to detect when everything has completely loaded on an SPA page including sub-resources such as images and stylesheets.

Are these useful for you ?

2 Likes

Serhat, thanks for pointing those out, I hadn’t seen them before.

I have just tried them with an Alert but nothing showed up. Do you know anything more about them? Do you know when they trigger and how best to return something when they do trigger?

Hello Neil ,

another way you can call server connect when router show up then you can call javascript when server connect on done (ondone event )


You have to do it with one of these solutions. Also, if you wait a few milliseconds with settimeout in javascript, you can get more successful results.

hopefully this will be the solution. good luck

and for the SPA you have a whole set of dynamic events on the routing component:

Good morning Serhat, I can’t get either of your suggestions to help me to detect when everything within an SPA page has loaded. As a simple guide, when a basic page has many images and the last one draws on screen, then that is usually a good indicator that everything has loaded and displayed on screen. I am looking for more than just the Server Connects loading etc.

The problem is that the nature of an SPA means that the Parent does not reload and therefore the
" document.readyState === 'complete' " will be correct even when the Child is still loading.

If I have misunderstood your suggestions then please help me to understand better. Cheers

Cheers George, I hadn’t spotted those either.

Unfortunately they don’t help with the original post, do you have any suggestions or guidance on that?

Hello Neil
SPA page is cache based and images are stored on client side. For this reason, the solution you want is only the operations that can be done after the server-side uploads are completed. So you should be able to do the controls that you can do with server connect, except that you will not find a complete solution. (At least I don’t know. :)) You can consider this situation as a disadvantage of working with cache.

I didnt try before but you can try disable cache ;

<meta http-equiv="Cache-Control" content="max-age=0, must-revalidate"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0" />

You are right, the whole point about these SPA pages are that they are quick to load and use cache where they can. Unfortunately, sometimes we want to disable the cache for some elements. Not exactly possible.

This will only stop the cache for the whole page which means Parent and Child, which then defeats the point of SPA pages. We want to be able to disable the cache for some elements.