Get started with navigo CDN
MIT licensed
Navigo: Lightweight JS library for client-side URL routing, no hash or history push.
Tags:- router
- vanilla
- hash
- history
Stable version
Copied!
How to start using navigo CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with navigo CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/navigo/8.11.1/navigo.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const router = new Navigo('/', { links: { home: '/', about: '/about' } });
router
.on('/', () => {
document.querySelector('#content').innerHTML = '<h1>Home</h1>';
})
.on('/about', () => {
document.querySelector('#content').innerHTML = '<h1>About</h1>';
});
router.resolve();
window.history.pushState(null, null, '/');
const link = document.querySelector('a[href="/about"]');
link.addEventListener('click', (e) => {
e.preventDefault();
router.navigate('/about');
});
});
</script>
<style>
#content {
width: 100%;
}
</style>
</head>
<body>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
</nav>
<div id="content"></div>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
All versions
5.3.1
5.3.2
5.3.3
6.0.0
6.0.1
6.0.2
7.0.0
7.1.0
7.1.1
7.1.2
7.1.3
8.0.0
8.0.0-beta.1
8.0.0-beta.10
8.0.0-beta.11
8.0.0-beta.12
8.0.0-beta.13
8.0.0-beta.14
8.0.0-beta.15
8.0.0-beta.16
8.0.0-beta.17
8.0.0-beta.18
8.0.0-beta.19
8.0.0-beta.2
8.0.0-beta.20
8.0.0-beta.21
8.0.0-beta.22
8.0.0-beta.23
8.0.0-beta.24
8.0.0-beta.25
8.0.0-beta.26
8.0.0-beta.27
8.0.0-beta.28
8.0.0-beta.29
8.0.0-beta.30
8.0.0-beta.31
8.0.0-beta.32
8.0.0-beta.4
8.0.0-beta.5
8.0.0-beta.6
8.0.0-beta.7
8.0.0-beta.8
8.0.0-beta.9
8.0.1
8.1.0
8.1.1
8.10.0
8.10.1
8.11.0
*** 8.11.1
8.2.0
8.3.0
8.3.1
8.3.2
8.4.0
8.4.1
8.4.2
8.4.3
8.4.4
8.5.0
8.6.0
8.6.1
8.6.2
8.6.3
8.6.4
8.6.5
8.7.0
8.7.1
8.7.2
8.7.3
8.8.0
8.8.1
8.8.10
8.8.11
8.8.12
8.8.2
8.8.3
8.8.4
8.8.5
8.8.6
8.8.7
8.8.8
8.8.9
8.9.0
8.9.1