Jivec
Jivec

Reputation: 1

window.location onload in Firefox

Probably a simple question for everyone. This displays the alert with the location in Chrome and Safari but it doesn't work in Firefox

<html> 
<head> 
<script type="text/javascript"> 
function onload() {
var loc = window.location;
alert("url is " +loc);
return false;
}
</script> 
</head> 
<body onload="onload()"> 
</body> 
</html> 

Any Ideas

Upvotes: 0

Views: 1773

Answers (1)

Lekensteyn
Lekensteyn

Reputation: 66435

Don't use names like onload.

<html> 
<head> 
<script type="text/javascript"> 
function loader() {
    var loc = window.location;
    alert("url is " +loc);
    return false;
}
</script> 
</head> 
<body onload="loader()"> 
</body> 
</html> 

Upvotes: 2

Related Questions