0

I want to parse an IE8, IE9 link in newer versions of IE , Chrome and so on.

Let's suppose i receive a link like this in Chrome :

http://mySite.com/myEvent?step=0#myEvent?requestNumber=mmmny98&stepId=1&_suid=543566456..

Chrome will convert this to :

http://mySite.com/myEvent?requestNumber=mmmny98&step=1 automatically and will set my step at 0 ( what it is before the hashed part ) .

If i use document.baseURI or smth like this i'll get the converted link .

I want to parse the non-converted link to get some informations from there ( set the current step and stuff like this ) .

4

1 に答える 1

0

次を使用して、ハッシュフォワードからすべてを取得できます。

document.location.hash

をハッシュから分割したい場合は?、次のようにすることができます。

document.location.hash.split('?')[1]

もちろん、エラーチェックを必ず行ってください...そのインデックスが存在することを知らずに分割配列にインデックスを付けないでください:)

于 2013-09-06T13:31:51.067 に答える