visionmedia / page.js

Micro client-side router inspired by the Express router

Home Page:http://visionmedia.github.com/page.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Page reload on redirect page("./pageToRedirect")

micabal opened this issue · comments

Would it be possible to parse the path and remove the leading dot in the url if any ?
Indeed, having a leading dot cause the page to reload. I have seen some people having the same issue.

page("./pageToRedirect") redirects with a page reload.

page("/pageToRedirect") works as expected

page.js/page.js

Line 1005 in 4f99916

function page(path, fn) {

In fact I realized that the unexpected behavior may be expected sometimes.

page("./pageToRedirect") redirects with a page reload => should be kept!

For example, when "login out" a user, it may be required to reload all resources. In my case, page.redirect("./") was perfect because it did not keep the "/logout" page in history and still reloaded resources.

The leading dot behavior should be kept but detailed in the documentation.