Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can.route.pushstate mishandles hash fragments #259

Closed
talentedmrjones opened this issue Jan 28, 2013 · 2 comments
Closed

can.route.pushstate mishandles hash fragments #259

talentedmrjones opened this issue Jan 28, 2013 · 2 comments
Assignees
Milestone

Comments

@talentedmrjones
Copy link

For links containing hash fragments like

<a href="/articles/17#references">

The URL gets set to /articles/17%23references and window.location.hash == ''

@justinbmeyer
Copy link
Contributor

Can you create a fiddle showing this because I'm not understanding what you mean exactly.

Sent from my iPhone

On Jan 28, 2013, at 9:55 AM, Richard Jones notifications@github.com wrote:

For links containing hash fragments like

The URL gets set to /articles/17%23references and window.location.hash == ''


Reply to this email directly or view it on GitHub.

@talentedmrjones
Copy link
Author

I take that back. I'm sorry the hash symbol being URL encoded was from a change I made to the core of the plugin.

Look here:https://github.com/bitovi/canjs/blob/master/route/pushstate/pushstate.js#L42

You will see this.pathname+this.search

window.location.hash is not included at all. Therefore the pushstate code does not allow for links that contain hashes. I'd like to use pushstate but also need to support hashes so I can jump to specific places in the page based on window.location.hash.

I've tried changing that line to this.pathname+this.hash+this.search but that ended up URL encoding the # and left window.location.hash empty.

@ghost ghost assigned justinbmeyer Sep 20, 2013
justinbmeyer added a commit that referenced this issue Sep 21, 2013
…ough to the setURL, some strange things needed to be done to get all the frameworks to work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants