I'm just learning to work with java script and I have run into a problem with cookies in IE. the following works in all browsers except IE (ver 8 and 11 tested). Debugging has led me to the fact that the trim() of spaces is where it is stopping in IE. But I've reached the limit of my knowledge as to how to change the code to make it work. Any suggestions would be greatly appreciated. Thanks Joe
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i].trim();
if (c.indexOf(name) == 0)
return c.substring(name.length, c.length);
}
return "";
}