我需要通过Javascript解析给定的url,但我无法使用.split()完成此操作。使用Javascript查找字符串中的“#”字符
IE:
var str = window.location.pathname;
var substr = str.split('/');
alert(substr)
如果我进入这个网址 “http://mydomain.com/myaddress/page/2/” 我有thoose价值观 “myaddress,页2”
但它不工作,如果不是/我插入#
确定'location.pathname'包含''#?通常以'location.hash'命名。 – Thilo 2012-04-24 12:59:56
可能的重复[从网址抓取哈希?](http://stackoverflow.com/questions/9043067/grabbing-hash-from-url) – 2012-04-24 13:04:28