I know I can get the hash value directly with this bit of code:
var hash = window.location.hash;
But is there anyway I can get the eve开发者_开发百科rything before the hash value directly as well?
Thank you!
Edit Using the Answer bellow: I am guessing the best way is..
var pageAddress = window.location.split('#')[0];
I use:
window.location.href.replace(window.location.hash, '');
you can try to subtract the has from the location
This took me 2s to Google: http://davidwalsh.name/javascript-window-location
You want to take the href and split it on the '#', easy enough to do in JS.
This may or may not be of interest, if you don't mind jQuery (I didn't write it):
jQuery BBQ: Back Button & Query Library: http://benalman.com/projects/jquery-bbq-plugin/
Just combine the text before the hash
window.location.origin + window.location.pathname + window.location.search
精彩评论