I\'m trying to post my SPA app that works fine locally but when I push it to Github Pages, the interior pages don\'t register if you navigate to them directly.
For
Add this code to your index.html
and 404.html
files:
// if it's on index.html
if (window.sessionStorage.path) {
let path = window.sessionStorage.path; // gets the path saved on sessionStorage
window.history.pushState(null, null, path); // push it on url
window.sessionStorage.removeItem('path'); // removes from session
} else { // if it's on 404.html (path doens't exist)
let path = window.location.pathname; // get the path url
window.sessionStorage.path = path; // saves on sessionStorage
window.location.href = '/'; // go to index
}