4 ms·
Used correctly, it can hugely speed up the experience by preloading things. In an ideal case you could have a fast initial page load with static HTML. Then an
by callumlocke 10y ago
Used correctly, it can hugely speed up the experience by preloading things.
In an ideal case you could have a fast initial page load with static HTML. Then an async script tag quietly loads a script in the background while the user is reading (done properly, this can be imperceptible). Then when the user clicks a link, JS handles it and instantly updates the DOM and location bar, faster than would be possible with a static page load.
That's not usually the reality but it's definitely possible.
- debaserab2 10y agoHow is that faster than loading a single HTML template with the "dom" already rendered correctly by the server?
- learc83 10y agoI think you missed this part >Then when the user clicks a link, JS handles it and instantly updates the DOM and location bar, faster than would be possible with a static page load. In the GP's example, the first page load is already rendered by the server. It's subsequent page loads that are rendered in JS.
- debaserab2 10y ago..so you want to preload the content of every link on the page? Because if it's just to display comments or something, I stand by my original statement.
- callumlocke 10y agoThat's a big revision of your original comment ;)