page.js icon indicating copy to clipboard operation
page.js copied to clipboard

Filename is lost on routing to root

Open AGoblinKing opened this issue 6 years ago • 1 comments

The filename component of location is lost when you navigate to "/".

EX:

  • hashbang routing
  • page located at http://foo.com/bar.html
  • click <a href="/example"/>
  • location is now http://foo.com/bar.html#!/example
  • click <a href="/" />
  • location is now http://foo.com (missing bar.html)

This comes up when using history.back() as well.

AGoblinKing avatar Aug 20 '18 23:08 AGoblinKing

Hi, i just made a pr and fixed the problem. the first problem was that you should've used

history.pushState(...);

instead of

history.replaceState(...);

and the second one was that you could use location.href in clickHandler function instead of pathname, search, and hash properties. make sure to inform me if anything was wrong with it.

NikanV avatar Jun 27 '23 14:06 NikanV