Search code examples
jqueryinternet-explorer-7internet-explorer-6

IE ERROR 'object doesn't support this property or method'


I have the following bit of code:

/* 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 */

This line is causing IE to Error 'object doesn't support this property or method'

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

Can anyone help?


Solution

  • Looking at the documentation for the document object, there is no "location" property, but there is a url property, so you should be coding:

       var path = document.url.toLowerCase();