Category: Internet Explorer

rss

Referer with document.location is broken in Internet Explorer

When you have (this should be discussed anyways) code in your javascript application changing to a different website, you'll see something similar to that:

1
location.href = 'test.php';

If you want to retrieve the referer on the next page, this will not work anymore. This is a known IE Bug and not fixed in IE 8.

For instance this in javascript:

1
location.href = 'test.php';

And this as test.php

1
echo $_SERVER['REFERER'];

In this case, the output in IE will always be empty. In the other big browsers, it works like a charm.

But there is always, also this time, a workaround. Found at web bugtrack.

If you use for all browsers such wrapper function:

1
2
3
function goto(url){
location.href = url;
}

You just have to make it like that for the one browser:

1
2
3
4
5
6
function goto(url){
var referLink = document.createElement('a');
referLink.href = url;
document.body.appendChild(referLink);
referLink.click();
}

As you can see, it will create a link with exactly the refer link. And will properly work then.

In JavaScript & Internet Explorer By DracoBlue @ 14:46 08.07.2009

Morph css background-position in Internet Explorer

If you try to set the CSS-property background-position in Internet Explorer (I tested with 7) and even use that with Mootools' morph/tween-functions, it will not work.

You can workaround that issue, if you set also background-position-x and background-position-y (actually ignored by my Firefox 3.0).

This is the code, I use at koala to move the background upwards.

1
2
3
4
$('body').morph({
'background-position':'0 -140px',
'background-position-y':'-140px',
});
In JavaScript, Mootools, CSS & Internet Explorer By DracoBlue @ 11:34 16.06.2009

Could not complete the operation due to error 80020101

This happend to me when I tried to load ajax-content in internet explorer (worked fine in Firefox, etc), which had a script-tag without a valid comments tag.

So just for the record, here is the solution, which helped me.

Before (Broken):

1
2
3
4
5
<script type="text/javascript">
<!--
alert('text');
// -->
</script>

Fixed (Working)

1
2
3
4
5
<script type="text/javascript">
// <!--
alert('text');
// -->
</script>
In JavaScript & Internet Explorer By DracoBlue @ 19:10 14.05.2009