Forum Moderators: open

Message Too Old, No Replies

window.location does not work in IE 6

         

defireman

3:29 am on Feb 26, 2006 (gmt 0)

10+ Year Member



I am having a strange problem with browser js redirects in IE6.

This is the code I am writing:

<script type="text/javascript">
function dropTag(droptag) {
var loc = window.location.toString();
var components = loc.split('/');
var tagstring = components[4];

var tagarray = tagstring.split(',');

if (tagarray.length == 1) {

window.location = "http://www.google.com";

} else {
var i = 0;
var remainingtags = new Array;
while (i < tagarray.length) {

if (droptag!= tagarray[i]) {
remainingtags.push(tagarray[i]);
}
i++;
}

tagstring = remainingtags.join(',');
components[4] = tagstring;
loc = components.join('/');
alert(loc);
window.location = loc;

}

}
</script>

The code works fine in Firefox. Can anyone spot my mistake? I checked various websites, but there are no indications of what I did wrong. Please help!

DrDoc

4:04 am on Feb 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



window.location.href

defireman

7:30 pm on Feb 26, 2006 (gmt 0)

10+ Year Member



I've tried it. It does not work. I am not sure why this is the case.

Bernard Marx

8:24 pm on Feb 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I guess that getting the information by splitting on "/" isn't reliable.

How about posting an example url (ie no using your domain name) so we can see what the general pattern is.

defireman

9:08 pm on Feb 26, 2006 (gmt 0)

10+ Year Member



actually, even using address like "http://www.google.com" does not work. I checked the script with alert()s, and made sure it reached the line with the redirect. It's just that IE refused to change the address, even with the command in place.

Bernard Marx

9:33 pm on Feb 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure I'm following you.

window.location.href = "...."

- that's the more precise version. It shouldn't make a difference though.