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

Fix wrong base for hashbang:true and protocol file: #518

Closed kaisermann closed 5 years ago

kaisermann commented 5 years ago

This was my bad in #514. I (wrongly) assumed the base path should be the directory path for hashbang: true and protocol file:, when it should be the actual full path of the page file (with i.e. index.html)

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.03%) to 92.116% when pulling bc4b8f8fd3ef63b72e99242168a870b49d860aa3 on kaisermann:fix-base-file-protocol into 572790c41bcfa29d0dd9b4d5f07efeba8cdb1209 on visionmedia:master.

raphinesse commented 3 years ago

After some debugging in a project that uses page.js, I also arrived at the conclusion that the page.base should actually be dirname(location.pathname). That way, relative links like <a href=foo>foo</a> would resolve to the same route, for both hash and non-hash based routing.

Thus I am curious what caused this behavior to be reverted. Can you share any insights @kaisermann?

raphinesse commented 3 years ago

Nvm, I figured out that changing the base as described above would break all popstate and manually triggered navigation.