visionmedia / page.js

Micro client-side router inspired by the Express router
http://visionmedia.github.com/page.js
7.67k stars 687 forks source link

page('/user/'+1234); change the base path #494

Open elprobes opened 5 years ago

elprobes commented 5 years ago

When i navigate from a function using page('/url/'+param); the script change the base path. So if the base path is '/mysite' and i use the above command the base path becomes '/url/param' and break everything. It's me or is this a bug? i expect that the base path doesn't change

matthewp commented 5 years ago

I believe this is a bug...

joezappie commented 3 years ago

Any progress on this? I too am experiencing this issue while trying to use electron-forge. In dev mode, it spins up a server with a base url with the name of the electron browser window: http://localhost:3000/main_window

I tried setting the base for page:

page.base('/main_window');
page('/');

That changes the URL to: http://localhost:3000/#!/

I don't think its changing the base back to to "/", but I think its not properly using the base variable. I came to this conclusion because of the following:

page.base('/main_window');
page('/');
console.log(page.base());

This properly logs "/main_window" so the base variable is still set. Not sure why its not being added when show is being called:

var pageBase = _page._getBase();
if ('/' === path[0] && 0 !== path.indexOf(pageBase)) path = pageBase + (hashbang ? '#!' : '') + path;