你能解决我的问题,请window.location.search.substring没有在IE 8的工作
window.location.search.substring没有工作在IE 8
问候
拉文德兰
你能解决我的问题,请window.location.search.substring没有在IE 8的工作
window.location.search.substring没有工作在IE 8
问候
拉文德兰
我读到:
位置的对象都有一个toString方法返回当前URL。你也可以给window.location分配一个字符串。这意味着在大多数情况下,您可以像使用字符串一样使用window.location。有时候,例如当你需要调用一个字符串的方法,你必须明确地调用toString
https://developer.mozilla.org/en/DOM/window.location
所以我想:
window.location.search.toString().substring(...)
?
事情是MDN代表Mozilla,问题是关于IE8。 – renoirb 2013-02-26 22:25:07
这不是IE8的工作。:( – 2014-01-30 11:28:37
也许相关:
的Internet Explorer(V9至少,这是我测试这里)没有填满location.search时,有一个在前面的哈希(#),并包万事成位置。散列代替。
这里是我的解决方法:
var query = window.location.search.substring(1);
if (!query) {
var hash = window.location.hash;
query = hash.slice(hash.indexOf('?') + 1);
}
它帮助我男人..非常感谢.. – 2014-06-04 09:30:38
它会在Internet Explorer工作,如果你改变它document.location.search.substr
什么是你的问题? – 2011-04-14 07:31:21
代码?没有? :(.... \ * *走开\ * – 2011-04-14 07:34:20
尝试使用'substr'代替 – Christian 2011-04-14 07:36:45