Slight inaccuracy in an article

On this page, the fourth para states that SPAs don’t change the URL as the user moves between the content. Is it correct? Coz when using such web apps, I’ve noticed the URLs do change in the address bar and can be copy-pasted into a browser to lead to the exact content.

Typically they do not, that’s part of why it’s a single page, which means a single URL.

You can still manipulate the URL and pass information to the app that way with a bit of extra work but it’s not really the default behaviour. The page would not be refreshed/reloaded when the URL changes.

Would need to see an example of a web app that you’re talking about to know more.

Like Gmail, for example. When you open the inbox section, the link in the browser bar ends with “#inbox”, but when you switch to starred, snoozed or any other section, the URL changes accordingly.

The page doesn’t seem to be reloaded so it seems like a SPA that manipulates the URL.

Maybe it’s fuzzy but the distinction is that the app is adjusting the page content AND THEN changing the URL itself.

In a standard webpage you click a link and the browser will send a new GET request with the new URL and the server will send you a new page.

The language in the lesson uses might a lot since it’s a bit fuzzy since an app can take control of these elements from the browser strictly.

This might not work properly in SPAs because technically, the URL of the web app doesn’t change. Since the URL of the web app doesn’t change, they can’t bookmark any specific page. Refreshing the page might reset the application to its initial state, rather than maintaining the current view.

wont the more accurate version be:
”SPAs can change the URL without reloading the page using the History API or hash routing.”

That is a workaround. The page is listing some disadvantages of an SPA and so it is accurate. No need to cover every single case and workaround in this introduction.

1 Like