Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Hacky routing
if (Meteor.is_client) {
var Router = Backbone.Router.extend({
routes: {
"" : "main",
":page": "main" //this will be http://your_domain/
},
main: function(page) {
document.body.innerHTML = "";
page = page?page:"index";
var frag = Meteor.ui.render(function () {
var i = Template[page]?Template[page]():"";
return i;
});
document.body.appendChild(frag);
}
});
var app = new Router;
Meteor.startup(function () {
Backbone.history.start({pushState: true});
});
}
<template name="hello">
hello
</template>
<template name="index">
home
</template>
<head>
<title>Stackoverflow</title>
</head>
<body>
</body>
@yozawiratama

This comment has been minimized.

Show comment Hide comment
@yozawiratama

yozawiratama Dec 26, 2013

how navigate to other page without lose session with this solution?

how navigate to other page without lose session with this solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment