diff --git a/ignite-html-router.js b/ignite-html-router.js
index 733526a..9b81b76 100644
--- a/ignite-html-router.js
+++ b/ignite-html-router.js
@@ -252,6 +252,11 @@ class Router {
static navigate(route, data = null, refresh = false) {
if (refresh) {
if (Router.hashMode) {
+ //In hash mode the route can't start with /, we have to handle it here.
+ if (route.startsWith("/")) {
+ route = route.substr(1);
+ }
+
window.location.hash = route;
window.location.reload();
} else {
@@ -259,13 +264,19 @@ class Router {
}
} else {
if (Router.hashMode) {
+ //In hash mode the route can't start with /, we have to handle it here.
+ if (route.startsWith("/")) {
+ route = route.substr(1);
+ }
+
window.location.hash = route;
- Router.states.push(route);
} else {
window.history.pushState(route, route, route);
- Router.states.push(route);
}
+ //Push the route to our internal states
+ Router.states.push(route);
+
//Create a new pushstate event and fire it.
var event = new Event("pushstate");
event.data = data;