Skip to content

re: Build a Single Page Application (SPA) Site With Vanilla.js VIEW POST


Do you have any idea how to implement hash-less routing on the client? I've tried and I failed.


Good question! I'll explore that. There are libraries that handle it but I will look into a pure source solution.


I have my successful solution here. Might write an article later.

GitHub logo patarapolw / minimal-rollup-ts-pug-sass-template

Rollup + TypeScript + Pug + SASS template with no plan for JavaScript frameworks, whatsoever

In short, more than history.pushState, you also need window.dispatchEvent(new PopStateEvent('popstate', { state: { to } })); if you don't have history.go.

Now, you can listen to popstate events.

code of conduct - report abuse