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

Why do setting window.location.hash and hasher.setHash result in different behavior of question mark %3F? #143

Open
lzl124631x opened this issue Feb 6, 2016 · 0 comments

Comments

@lzl124631x
Copy link

Demo here

console.clear();
//crossroads.normalizeFn = crossroads.NORM_AS_OBJECT;
crossroads.addRoute(
    'page{?url}',
    function (query) {
    console.log(query);
});

hasher.init();
hasher.changed.add(function(hash) {
    crossroads.parse(hash);
})
hasher.setHash('page?url=begin%3Fend%2F');
console.log(hasher.getHash());
window.location.hash = 'page?url=begin%3Fend%2F';
console.log(hasher.getHash());

As you can see, if I directly set the window.location.hash (which is more commonly used since clicking on has the same behavior), the question mark is gone, while the question mark is kept if I use hasher.setHash? How come this discrepancy?

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

1 participant