3 ms·
A page refresh is what I call "throwing things out". Once you load your page, you don't need to load it again. Just make ajax calls to server from then on, and
by ClayFerguson 10y ago
A page refresh is what I call "throwing things out". Once you load your page, you don't need to load it again. Just make ajax calls to server from then on, and use the JSON response from the server to update the DOM. A page-refresh blows away the entire DOM, and is just a bad design IMO.
- tene 10y agoHe said that he built a single-page app to avoid page refreshes; where did you see in his comment (or when using Grooveshark? somewhere else?) that he refreshed the page or otherwise threw things out?
- ClayFerguson 10y agoI think we agree and are misunderstanding each other. Yes if you have an SPA there is no refresh, no throwing things out, and it's good.
- Kiro 10y agoI think you need to read the post you replied to again. There are no page reloads going on in Grooveshark. It's a proper SPA.
- kedean 10y agoWas*, GrooveShark shut down in 2015.
- ClayFerguson 10y agoYou are correct. My post was not about grooveshark or in any way related to grooveshark.
- tobltobs 10y ago"A page-refresh blows away the entire DOM, and is just a bad design IMO." Why? Really seriously question. Assuming everything is cached and it is not some super large app what's the problem with that?
- ClayFerguson 10y agometa64 is more of an APP than a webpage. For example, opening and closing dialogs is done by creating and destroying a DIV. It's not done by reloading the page, and rendering a new template on the server to send down. The reason I don't want to destroy the state of the DOM and client side variables is this: Have you ever seen a desktop app that resets all its variables back to null when a user clicks a button? Have you ever seen a desktop app that calls its 'main()' routine over and over again? Ask yourself why. There's just no reason to reload everything. Just start the app, and let it run. DOM is perfectly capable of updating the screen/page without a URL request being sent. Sending a url request to update something is stone-age thinking and 1990s design. It's the exact reason the world is moving to SPAs