visionmedia / page.js

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

page reload after clicking anchor #383

Closed tomhuynen closed 6 years ago

tomhuynen commented 8 years ago

Hi,

It seems that the page refreshes after adding an anchor hash to the end of the url. IE: mysite.com/#test

Possible cause:

In page.js line 335 the current and canonical path are compared like this:

current === ctx.canonicalPath

The current is composed like this:

current = location.pathname + location.search;

It works again when I add the location.hash:

current = location.pathname + location.search + location.hash;

Regards,

Tom

matthewp commented 6 years ago

Hey @tomhuynen, sorry for the long time without a reply. I tried changing the hash in one of the examples and I didn't see the problem that you are reporting here. Here's what I get:

change-hash2

Can you provide more information on what causes this bug? Is it a specific browser version?

Going to close for now, happy to reopen if we can get more info to make it reproducible.