Forum Moderators: open

Message Too Old, No Replies

Problems with Netscape/Javascript/onLoad()

work around it? Netscape onload or javascript not working

         

mikejson

4:52 pm on Sep 23, 2003 (gmt 0)

10+ Year Member



I'm trying to have a page that when it loads the body it will redirect to a different page. Reason being, I have redone the entire website, but alot of people have links to our previous pages, so the major ones I am forwarding to the proper places.

Now my code is something like this

...
function goNew(){
document.location = 'http://www.example.edu/admissions/apply/exp_profile.php' ;
}

//-->
</script>
</head>

<body onLoad= "goNew()" >
...

Now this works perfectly fine in IE, but I want it to work for ALL browsers.

Any answers out there?

[edited by: korkus2000 at 5:28 pm (utc) on Sep. 23, 2003]
[edit reason] examplified URL [/edit]

korkus2000

5:28 pm on Sep 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this:

function goNew(){
window.location = 'http://www.example.edu/admissions/apply/exp_profile.php' ;
}

The location property is part of the window object.

mikejson

1:38 pm on Sep 24, 2003 (gmt 0)

10+ Year Member



that didn't work either....

korkus2000

3:55 pm on Sep 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So what happens in the other browsers? What other browsers does it not work in? Any other scripts on the page?

mikejson

6:38 pm on Sep 24, 2003 (gmt 0)

10+ Year Member



I've only tried it in 2 browsers(IE and Netscape). IE gets to the page that the javascript directs it to when the body loads. Netscape shows the html of the page.

MonkeeSage

10:45 am on Sep 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In both cases the onload event is firing since you get a notable change; if it were not working in one of the browsers nothing noticible would happen at all, it would just sit there as if you used no JavaScript. That being that case, I'd venture a guess that the problem lies in the PHP page. You can try changing the url to google.com instead of the php page to test it.

Jordan

mikejson

12:49 pm on Sep 25, 2003 (gmt 0)

10+ Year Member



In netscape it doesn't actually do anything. The onLoad doesn't fire. But the weird thing is, when it shows the page, it doesn't treat it like a web page, it treats it like a text file, showing the source of the page. If onLoad doesn't fire, you'd think it would show just a blank page. Nothing in the body at all in the source.

Thats why this is baffling me. Can anyone else out there test if Netscape does infact work properly when using onload in the body tag?

Thanks for the help all

korkus2000

12:55 pm on Sep 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Which version of netscape is it?

MonkeeSage

1:33 pm on Sep 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could try taking out the onload attribute from the body and putting this at the end of your script block just below the goNew() function...

window.onload = goNew;

Jordan

mmdesign

3:05 pm on Sep 25, 2003 (gmt 0)

10+ Year Member



Could be missing ";" as follows:

I think your <body onLoad= "goNew()" > should be <body onLoad= "goNew();" >

mikejson

3:28 pm on Sep 25, 2003 (gmt 0)

10+ Year Member



korkus, I was informed that Netscape communicator 4.xx is doing this, and I also had the same thing with Netscape 7.

I'm tryin the ; thing, but I don't have time until tonight, I'll post back my findings tomorrow

mikejson

12:43 pm on Sep 26, 2003 (gmt 0)

10+ Year Member



Ok, I think it could be that netscape has a problem with cgi files.... not sure though, but this has a cgi extension on the file and it shows the source....

Anyone know of this?

mikejson

2:39 pm on Sep 29, 2003 (gmt 0)

10+ Year Member



/bump....(don't know if this is frowned apon in this forum or not)

still lookin for an answer to the question

I think it could be that netscape has a problem with cgi files.... not sure though, but this has a cgi extension on the file and it shows the source....