IE ERROR'对象不支持此属性或方法'

时间:2011-08-22 11:08:55

标签: jquery internet-explorer-7 internet-explorer-6

我有以下代码:

/* Set registered Cookie to TRUE if uri is  /registrationSuccess */
var path = document.location.pathname.toLowerCase();
var re = new RegExp("/registrationSuccess","i");
if (re.test(path )) {
    $.cookie("fpsRegistered", "true", { path: '/'});
}
/* End of cookie reg */

此行导致IE错误'对象不支持此属性或方法'

var path = document.location.pathname.toLowerCase();

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

查看document对象的the documentation,没有“location”属性,但有一个url属性,所以你应该编码:

   var path = document.url.toLowerCase();