问题
I know this could be sounding weird at first read. Please do not drop the idea as a nonsense just because of this.
Suspend and resume rendering is a common thing since complex GUIs arose, in many UI frameworks including Java GUIs and .NET has similar facility. The main idea behind this a) [do not use resources unnecessary] and b) [do not flicker the screen] while a multi step screen/control update in progress and being in temp stages.
My concern is mainly about the navigation. When the user navigates from one page to another, ugly flashes (always in Chrome) and resizes occur.
I do know that using AJAX techniques and/or frames we can help on this, and simply suspend/resume the rendering will not solve and optimize say the bandwidth usage. Still, a simple suspend/resume will drastically improve the visuals even on an ajax optimized page just because a tiny part of the page stops flashing, jumping up then back, or a scrollbar stops its showing then disappearing etc.
I am wondering that nowadays when user experience is so important, it practically drives product sales, and beats concurrent products, still browsing experience can be improved by adding/using this simple feature.
I suppose this could be a browser specific feature/hack and not part of the standard (available via a simple Javascript call). Btw why not?
Is there any chance I can implement this (or similar) behavior to improve my site user experience?
Thanks in advance
回答1:
The goals you have stated:
a) [do not use resources unnecessary] and b) [do not flicker the screen] while a multi-step screen/control update in progress and being in temp stages
are all solved in the approach of SPA (single page application). It gives you many different options for controlling the behavior of the applications state and doesn't require you to care about browser renderings.
The cool thing is, that one can choose different technical stacks, based on needs and knowledge.
For example:Angular or pure ASP.NET, or tonnes of different frameworks out there
So, if to be specific on answering your question: that would definitely be considered as a 'bad practice' to pause browser while rendering specific parts of code in your application. Also, keep in mind that supporting and scaling an application which modifies the normal execution thread will turn into nightmare and timewasting. And you would need to dig into API of each browser you want your app to work in, including different devices and platforms.
来源:https://stackoverflow.com/questions/29555703/how-to-temporary-suspend-browser-rendering-then-resume-for-the-whole-page