Open lzl124631x opened 8 years ago
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?
window.location.hash
hasher.setHash
Demo here
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 usehasher.setHash
? How come this discrepancy?