3

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");
}
Anirvan
  • 6,214
  • 5
  • 39
  • 53
jcmitch
  • 2,088
  • 9
  • 27
  • 33

1 Answers1

5

Change to:

window.onload = setRedirect;

Also see this jsfiddle.

scessor
  • 15,995
  • 4
  • 43
  • 54