View Full Version : Browser detect and redirection
celticking
06-27-2001, 02:57 PM
I have a database that when searched lists users. When you select a user, the profile page opens in a new window. There's problems with the page in Netscape so i want to have two. I need the browser the user is using to be detected then sent to the correct profile page.
Can anyone help?
Thanks.
Dr. Web
06-27-2001, 04:19 PM
this was modified from a1 javascripts. You can modify it a bit to suit your needs.
<html><head>
<Script>
function jump(){
<!-- A1 Javascripts-http://www.A1javascripts.com --><!--
if (document.all) {//IE4,5
loc = 'Your-IE4,5-choice.html'
}else if (document.layers){ //NS4
loc = 'Your-NS4-choice.html'
}else if (document.getElementById){ //NS5
loc = 'Your NS5 Choice.html'
}else if (document.images){ //NS3,IE4
loc = 'Your-NS3,IE4-choice.html'
}else{ //NS2,IE3
loc = 'Your-NS2,IE3-choice.html'
}
win = window.open(loc, "dep", "height=600,width=800", hotkeys="no", toolbars="no", resize="no");
//-->
}
</Script>
</head><body>
<form name=form1>
<input type=button value="jump to correct browser page" onClick="jump();">
</form>
</body>
</html>
celticking
06-27-2001, 04:56 PM
It's appreciated.
celticking
06-28-2001, 11:55 AM
I'm having trouble applying that.
So far, i have the following..
function redirect() {
if (navigator.appName.indexOf("Netscape") >=0) location.href="itc_detail2.lasso?user=[field:'username']";
}
How do i call the function correctly from my hyperlink...
<a href="/itc_detail.lasso?user=[field:'username']" target="_blank">
[field:'username']</a>
Thanks again.
PCheese
06-28-2001, 12:09 PM
<a href="WHATEVER" onclick="return redirect()">
...hopefully.
celticking
06-28-2001, 12:31 PM
Unfortunately that's not working. When i run the page in Netscape, i'm taken to detail.lasso, not detail2.lasso as i want to be if Netscape.
Any other ideas?
Dr. Web
06-28-2001, 01:25 PM
the code your using does not look like what I gave you. Heres the code, modified for a hyperlink. Also, I tested it on IE and Netscape 4.7.... worked like a charm.
<html><head>
<Script>
function jump(){
<!-- A1 Javascripts-http://www.A1javascripts.com --><!--
if (document.all) {//IE4,5
loc = 'Your-IE4,5-choice.html'
}else if (document.layers){ //NS4
loc = 'Your-NS4-choice.html'
}else if (document.getElementById){ //NS5
loc = 'Your NS5 Choice.html'
}else if (document.images){ //NS3,IE4
loc = 'Your-NS3,IE4-choice.html'
}else{ //NS2,IE3
loc = 'Your-NS2,IE3-choice.html'
}
win = window.open(loc, "dep", "height=600,width=800", hotkeys="no", toolbars="no", resize="no");
//-->
}
</Script>
</head><body>
<form name=form1>
<a href="#" onClick="jump()">Click here!</a>
</form>
</body>
</html>
celticking
06-28-2001, 02:26 PM
Sorry Dr Web, it's just not going to work, my code is too complex, i was able to lose our databse code, lasso and place it at the top of the target page...
[variable_set:'detail2'=(string_concatenate:'http://www.inthecredits.com/itc_detail2.lasso?user=',(form_param:'user'))]
[if:(string_findposition:find='MSIE',(client_type))<0] [redirect_url:(variable:'detail2')]
[else]
Seems to work fine and no more headaches.
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.