example url
-
add cdn link to your html file in end of body
<script src="https://cdn.jsdelivr.net/gh/pushkarydv/basic-single-page-application@main/index.js"></script> -
add a script just after cdn
-
adding pages
<section id="page1"></section>you can add as many pages as you want
addPage("page1");this will basically hide it from page and it will be called when url changes fir example
https://basicspa.vercel.app/#threethis page will only show section of id three other all pages added will be hidden -
setting main page of app
setMainPage("one"); -
pagesInit(); -
redirect without refreshing
<a href="#one" class="pageLink" onclick="goToPage('one')">go to one</a>