jcmitch
jcmitch

Reputation: 2166

document.body.onload in Firefox

Okay so I'm using Javascript to set the onload attribute of a page. It works in IE but not Firefox. Does anyone know a fix for this? Neither IE or Firefox is throwing an error. I'm using the Firefox plugin "Web Developer" and it isn't showing any JavaScript errors. Code below: Thanks.

document.body.onload = setRedirect;
function setRedirect()
{
    alert("TEST");
}

Upvotes: 3

Views: 5693

Answers (1)

scessor
scessor

Reputation: 16115

Change to:

window.onload = setRedirect;

Also see this jsfiddle.

Upvotes: 5

Related Questions