为什么window.location.href没有在IE中显示哈希值

时间:2012-05-06 14:42:40

标签: javascript hash

window.location.href = 'www.mysite.com/testpage/#12';

在Chrome和Firefox中,用户被重定向到www.mysite.com/testpage/#12 successfuly,但是在IE中用户被导向www.mysite.com/testpage/没有哈希,我该如何强制浏览器阅读哈希?

更新:

这是实际的代码:

window.location.href = siteurl+'?selection/'+edu_year_selectionreal+'/'+semester_selectionreal+'/'+subject_selectionreal+'#?selection/'+edu_year_selectionreal+'/'+semester_selectionreal+'/'+subject_selectionreal+'/'+edu_year_selectiontitle+'/'+semester_selectiontitle+'/'+subject_selectiontitle;

在IE中它从(#?)

开始停止阅读

1 个答案:

答案 0 :(得分:0)

发现错误: siteurl+'?selection/应为siteurl+'/?selection/,并在网址的两个部分之间添加额外的'/'