I have a question that I didn't know where else to ask. How exactly does dev.to produce it's SPA-like navigation? I can see it's getting the document using ajax, handled by the service worker if it's cached. But what mechanism loads the new doc body? Is it just a vanilla JavaScript injection? How are the navigation actions intercepted on the client-side?
We basically take the server response and replace the page, but we only take the body element. The nav bar and footer and basic template. But as far as the app's logic outside of this context is concerned, it's pretty much a server-rendered app.
We basically use a hacked up version of InstantClick to make this happen.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I have a question that I didn't know where else to ask. How exactly does dev.to produce it's SPA-like navigation? I can see it's getting the document using ajax, handled by the service worker if it's cached. But what mechanism loads the new doc body? Is it just a vanilla JavaScript injection? How are the navigation actions intercepted on the client-side?
Here's where the code is, which is quite crappy and messy to be honest:
github.com/thepracticaldev/dev.to/...
We basically take the server response and replace the page, but we only take the body element. The nav bar and footer and basic template. But as far as the app's logic outside of this context is concerned, it's pretty much a server-rendered app.
We basically use a hacked up version of InstantClick to make this happen.