Welcome to WebmasterWorld Guest from 54.163.25.166

Forum Moderators: open

Message Too Old, No Replies

combining an onload pop-up with a javascript browser redirect

How can I combine the two

     
1:48 pm on Mar 5, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 5, 2003
posts:38
votes: 0


I have two scripts: An onload window script and a browser redirect script. Basically the onload window script automatically loads my main page as a pop up window. However, I use Inline Frames for my site, and Netscape 4.7 and older does not support them. What I can do is use the the browser detection script to redirect my netscape users to another page that doesn't have Inline Frames. But, I can't redirect my netscape users using the onload window script. Basically, I want to know how I can combine the two.

<SCRIPT LANGUAGE="Javascript">
var browser = navigator.appName
if (browser == "Microsoft Internet Explorer")
url=("clients.htm");
else
url=("features.htm")
document.location.href=url;

</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">

<!--
function WindowOpen() {

msg=window.open('features.htm', 'Sample', 'toolbar=no',
'location=no',
'directories=no',
'status=yes',
'menubar=yes',
'scrollbars=no',
'resizable=no',
'copyhistory=yes',
'width=755','height=480');
}

//-->

</SCRIPT>

<body onLoad=WindowOpen()>

3:31 pm on Mar 5, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
posts:3732
votes: 0


What do you mean combine the 2?
3:50 pm on Mar 5, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 5, 2003
posts:38
votes: 0


The redirect script overrides the pop up script; therefore, ignoring the pop up script.

What I want is for the redirect script to recognize the browser, either explorer or netscape, then initiate the onLoad=WindowOpen()

If you have any recommendations for me, so that my users can first:

1. be redirected, based on their browser, and
2. go to either page, based on the onLoad=WindowOpen()

Sorry if this inquiry is confusing.

3:53 pm on Mar 5, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
posts:3732
votes: 0


Are you trying to just redirect netscape and stay at the same page with ie?

Like

<SCRIPT LANGUAGE="Javascript">
var browser = navigator.appName
if (browser == "Microsoft Internet Explorer"){
WindowOpen();
}else{
url=("features.htm")
document.location.href=url;
}
</SCRIPT>

4:28 pm on Mar 5, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 5, 2003
posts:38
votes: 0


Thank you for the advice, but when I launched my page in Netscape, the page froze up. This is what I did:

1. First Page:(demo4.htm)

<SCRIPT LANGUAGE="JavaScript">

<!-- HIDE
function popup() {
var newWin = window.open("features2.htm", "method_desc", "status=no,width=300,height=200")
}
//STOP HIDING -->

</SCRIPT>

</head>
<BODY onLoad="popup()">

2. Second Page (features2.htm)

<SCRIPT LANGUAGE="Javascript">
var browser = navigator.appName
if (browser == "Microsoft Internet Explorer"){
WindowOpen();
}else{
url=("features3.htm")
document.location.href=url;
}
</SCRIPT>

So, what should happen is when my features2.htm is launched in Netscape, that page will be redirected to features3.htm. However, when the page is redirected it freezes up and the curser blinks. Sorry to keep on bothering you about this problem. I'm almost their but still have these problems.

Thanks

4:50 pm on Mar 5, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
posts:3732
votes: 0


Try changing your second script to this.

<SCRIPT LANGUAGE="Javascript">
var browser1 = navigator.appName;
if (browser1 == "Microsoft Internet Explorer"){
WindowOpen();
}else{
window.location.href="features3.htm";
}
</SCRIPT>

4:50 pm on Mar 5, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 5, 2003
posts:38
votes: 0


I kind of fixed the problem, mainly from your input. Thanks!This is what my first page(demo4.htm) looks like

<SCRIPT LANGUAGE="JavaScript">

<!-- HIDE
function popup() {
var newWin = window.open("features2.htm", "method_desc", "status=no,width=300,height=200")
}
//STOP HIDING -->

</SCRIPT>
<SCRIPT LANGUAGE="Javascript">
var browser = navigator.appName
if (browser == "Microsoft Internet Explorer"){
WindowOpen();
}else{
url=("features3.htm")
document.location.href=url;
}
</SCRIPT>

</head>
<BODY onLoad="popup()">

A Netscape user will be redirected to features3.htm, but not as a pop up window. Do you know any way I could fix this?

4:58 pm on Mar 5, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 5, 2003
posts:38
votes: 0


I fixed the problem. Thanks very much for your input: You saved me hours looking around to find a solution to my problem.