homepage Welcome to WebmasterWorld Guest from 23.20.28.193
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
combining an onload pop-up with a javascript browser redirect
How can I combine the two
deltron23




msg:1491940
 1:48 pm on Mar 5, 2003 (gmt 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()>

 

korkus2000




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

What do you mean combine the 2?

deltron23




msg:1491942
 3:50 pm on Mar 5, 2003 (gmt 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.

korkus2000




msg:1491943
 3:53 pm on Mar 5, 2003 (gmt 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>

deltron23




msg:1491944
 4:28 pm on Mar 5, 2003 (gmt 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

korkus2000




msg:1491945
 4:50 pm on Mar 5, 2003 (gmt 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>

deltron23




msg:1491946
 4:50 pm on Mar 5, 2003 (gmt 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?

deltron23




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved