[whatwg] [ScrollRestoration] API to notify browser when page finished loading?
johannes.spangenberg at hotmail.de
Thu Aug 17 19:12:52 PDT 2017
I was not sure where to ask this question. However, this draft was referenced by Chrome and Mozilla. So, hopefully this is the right place. I can also create a GitHub Issue at https://github.com/majido/scroll-restoration-proposal/issues if you like.
Lets come to the question. If I understand the current draft correctly, it only allows disabling scroll restoration performed by the borwser. This means that applications still have to implement scroll restoration manually. Other persisted user state (like user input on input fields) seems not to be considered at all. Do I have understood it correctly?
If I have understood it correctly, I would like to know whether you have considered an alternative API as described in the following sentences. Basically, the problem seems to be that the browser does not know when the page finishes loading. Therefore, my suggestion would be to add an API to notify the browser when the page was loaded successfully. An example for such API would be a function like this:
delayStateRestoration(promise:Promise<void>) : void
Calling this function would only be allowed while handling popstate event or before initial loading of page has finished. Calling this function when the page has already been loaded does not make sense.
More information about the whatwg