Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 02-08-2004, 11:46 AM   #1 (permalink)
Fear the bunny
 
Location: Hanging off the tip of the Right Wing
Browser Redirect Help?

I want a script that will automatically force a user to a certain page should they be using a browser other than IE or Netscape. I think the Java script should be fairly simple, but I don't know how to write it and I can't find what I want anywhere.

Basically, anytime they go to one of my pages, it'll sense what browser they are on, and only allow them onto the page they want if they are using IE or Netscape. Otherwise, they'll be redirected to another page.

Thanks.
__________________
Activism is a way for useless people to feel important.
BoCo is offline  
Old 02-08-2004, 12:46 PM   #2 (permalink)
Junkie
 
Location: San Francisco
These kinds of scripts are morally wrong. JavaScript == evil =P
n0nsensical is offline  
Old 02-08-2004, 12:51 PM   #3 (permalink)
Banned
 
Location: 'bout 2 feet from my iMac
n0nsensical has it. how 'bout you code to standards instead? That way EVERYONE can see your site.
and here IS the spec: http://www.w3.org/MarkUp/

and here's a validator: http://validator.w3.org/

and here's a poll on who's using what browser rthat suggests you're cutting off half your potential audience: http://www.tfproject.org/tfp/showthr...hlight=browser

please note that AS MANY people are using mozilla as are using IE, and ther's another nearly third of the group using konquerer and opera.

Seriously, that's just not a good idea, and will hurt your site more than help it.
cheerios is offline  
Old 02-08-2004, 12:59 PM   #4 (permalink)
Fear the bunny
 
Location: Hanging off the tip of the Right Wing
Help or don't bother replying.
__________________
Activism is a way for useless people to feel important.
BoCo is offline  
Old 02-08-2004, 01:20 PM   #5 (permalink)
Banned
 
Location: 'bout 2 feet from my iMac
I WAS offering help. We're telling you it's a bad idea and offering alternatives. that's the best help we can offer. if you don't wanna hear it, don't ask stupid questions.
cheerios is offline  
Old 02-08-2004, 01:56 PM   #6 (permalink)
Fear the bunny
 
Location: Hanging off the tip of the Right Wing
I don't want alternatives. That's like telling someone to get their ear pierced when they're trying to decide which tattoo they should get.

It's not a stupid question, either. I know there's a way to do it, AND SINCE IT'S MY OWN DAMN SITE I CAN DO WHATEVER I WANT WITH IT WITHOUT YOUR PERMISSION!

If anyone has actual advice or a place to get the code, then thanks for helping.
__________________
Activism is a way for useless people to feel important.
BoCo is offline  
Old 02-08-2004, 02:05 PM   #7 (permalink)
Banned
 
Location: 'bout 2 feet from my iMac
14:03 %juanvaldes> no person that cares about the web would ever help you
14:03 * SecretMethod70 agrees with juanvaldes
cheerios is offline  
Old 02-08-2004, 02:39 PM   #8 (permalink)
Tilted
 
Wow, such hositility from the purists. Maybe you need to go back a re-read line #3

http://www.tfproject.org/tfp/showthr...&threadid=1980
goof7ball is offline  
Old 02-08-2004, 02:44 PM   #9 (permalink)
Submit to me, you know you want to
 
ShaniFaye's Avatar
 
Location: Lilburn, Ga
Sorry Boco cant offer what you need, but geez people...this is his website, I'm sure he's got a very good reason for wanting to do this and is it really our place to tell him what to do with his own site? He didnt ask for an opinion on what he was doing, just for the help in doing it.
__________________
I want the diabetic plan that comes with rollover carbs. I dont like the unused one expiring at midnite!!
ShaniFaye is offline  
Old 02-08-2004, 11:22 PM   #10 (permalink)
Upright
 
I strongly recommend against doing this because:

a. first off, the reasons cheerios stated above are *very* valid and I would recommend listening to them

b. many browsers other than ie/netscape, for this very reason, have plugins/options to fake useragents, so the website thinks they are IE/netscape even when they are not. I know this works with server-side browser detection, not too sure about client-side (eg. javascript).

c. netscape uses the Mozilla gecko rendering engine. So do a lot of other browsers (Mozilla, Mozilla Firebird, Konqueror, Camino), so really you gain nothing by blocking them. Also, a lot of browsers use IE with a different gui (not sure if they change useragents or not though). Apple's safari browser apparently renders very well as well - do you want to alienate many macosx users?

With this in mind, if you still want to do it, go ahead, it's your site. Google for "javascript useragent" - it should give you the stuff you want.
mgcloud is offline  
Old 02-08-2004, 11:50 PM   #11 (permalink)
Junkie
 
Location: San Francisco
You're right, I didn't answer the question, but I still have the right to complain. =P The way I see it, he's either going to use it to make a site that discriminates against Mozilla, Opera, Safari, etc., or he's going to use it as the answer to a homework problem. Either way, everyone loses because if he publishes it, it's yet another site that uses lame JavaScript to the detriment of the browsing public, and if he uses it as the answer to homework, he doesn't learn how to do it himself and he gets a D on his midterm

Maybe he wants it for neither of those reasons but in any case I'm not going to be the one to publish evil JavaScripts for everyone to find and use for their nefarious purposes. =P Well, I can always uncheck Firebird's handy "Enable JavaScript" box. Also, I don't think we're the ones being hostile...
n0nsensical is offline  
Old 02-09-2004, 09:28 PM   #12 (permalink)
Everything's better with bacon
 
SaltPork's Avatar
 
Location: In your local grocer's freezer.
WTF? Geez, the poor guy asks a simple question and gets slammed, damn. Maybe instead of being self-righteous, you could offer simple advice like, "Do a google search and you should find what you're looking for."

I would never recommend anyone do special coding for Opera or Safari. They don't conform to the standards and they are a huge pain in the ass to code for/around.

And before you get all pissed at me maybe you should read what Boco posted originally and then read your responses. He never said, "Can someone tell me the best way to over-complicate a simple request?" But that's what happened.

I could go on, but I won't. I'm sure I've pissed off a few of you by posting this, but you really need to get over it.
__________________
It was like that when I got here....I swear.
SaltPork is offline  
Old 02-09-2004, 11:27 PM   #13 (permalink)
Fear the bunny
 
Location: Hanging off the tip of the Right Wing
No one even asked if perhaps the page they would be redirect to was going to be designed differently so it'd work with other browsers so I don't have to re-do my current codes.

By the way, I have a few more things to say:

1) If you don't want to help or have nothing nice to say, then just don't post. It's one of the rules of the board.

2) The only reason that anyone uses a browser other than IE (unless they're on a Mac) is because of elitism. Seriously, though, if the only bit of elitism I could muster was that I use a different internet browser than 99.99% of the rest of the world, then I'd probably just kill myself.

3) You people all assumed I was deliberately going to be an ass without me even explaining myself fully. However, not a one of you is my wife or mother so I don't have to explain myself any more than what I want. If I ask a question, please answer it or go away; it's that easy.
__________________
Activism is a way for useless people to feel important.
BoCo is offline  
Old 02-10-2004, 02:52 AM   #14 (permalink)
Insane
 
Location: Seattle?
Quote:
Originally posted by mgcloud

b. many browsers other than ie/netscape, for this very reason, have plugins/options to fake useragents, so the website thinks they are IE/netscape even when they are not. I know this works with server-side browser detection, not too sure about client-side (eg. javascript).
[/B]
Yup, OmniWeb for OS X does this routinely, both to servers and JavaScript. I know OW isn't the only one that does, either. But, so long as BoCo realizes that he's just doing this for his own amusement, there's no harm in fiddling with navigator.appName or some (more valid) trick he finds on the Web.

It's not like any browser I use will care one way or the other.

-----

(Please note that I am too tired and indifferent to see whether navigator.appName is actually the right property. I was always more of a server-side guy anyhow )
webfiend is offline  
Old 02-10-2004, 08:42 AM   #15 (permalink)
Darth Papa
 
ratbastid's Avatar
 
Location: Yonder
You know all the reasons this is a bad idea, BoCo, so I'm going to assume you're the grown-up that I know you are, and that you'll use this thing responsibly.

Code:
<script language="JavaScript" 
type="text/JavaScript">
if(navigator.appName == "WebTV")
{
 window.location = "WebTVHome.html"
}
 if(navigator.appName == "Netscape")
{
 window.location = "NetscapeHome.html"
}
 if(navigator.appName == "Microsoft Internet Explorer")
{
 window.location = "ExplorerHome.html"
}
 window.location == "Other.html"
</script>
Basically you're making if statements that test the value of navigator.appName, and set window.location depending on what it finds. Not too tough. The window.location breaks processing on the script, so that dangling assignment at the end works as an "else" clause.

Note, I didn't write this, I saved myself some time by googling for it. I can't vouch that it'll work anywhere at any time for anybody on any browser or platform.
ratbastid is offline  
Old 02-10-2004, 12:02 PM   #16 (permalink)
Junkie
 
Location: San Francisco
Quote:
Originally posted by wrkime
WTF? Geez, the poor guy asks a simple question and gets slammed, damn. Maybe instead of being self-righteous, you could offer simple advice like, "Do a google search and you should find what you're looking for."
I wasn't trying to slam him if that's what it looks like. It's just that I've seen so many bad JavaScripts it's hard not to complain about them at every possible opportunity. The signal-to-noise ratio for JavaScripts is near 0. In my opinion, being a "Google"-bot is worse than making valid suggestions about web design, and neither one is answering the question anyway.

Quote:
Originally posted by wrkime
I would never recommend anyone do special coding for Opera or Safari. They don't conform to the standards and they are a huge pain in the ass to code for/around.
Quote:
Originally posted by BoCo
2) The only reason that anyone uses a browser other than IE (unless they're on a Mac) is because of elitism. Seriously, though, if the only bit of elitism I could muster was that I use a different internet browser than 99.99% of the rest of the world, then I'd probably just kill myself.
Comedy gold.

Quote:
Originally posted by wrkime
And before you get all pissed at me maybe you should read what Boco posted originally and then read your responses. He never said, "Can someone tell me the best way to over-complicate a simple request?" But that's what happened.

I could go on, but I won't. I'm sure I've pissed off a few of you by posting this, but you really need to get over it.
I don't know why I would be pissed off. Amused, yes. Some people just seem to have different ideas for what makes good web design, as well as different ideas for what makes a good reply.
n0nsensical is offline  
Old 02-10-2004, 02:56 PM   #17 (permalink)
undead
 
Location: nihilistic freedom
Hey BoCo,

Couple suggestions:

1) Try using .htaccess file to do the redirection. This is a pretty slick cause your end user won't notice the redirection, it's all done server side. Do something like RewriteCond %{HTTP_USER_AGENT} ... You may or may not be able to configure this depending on your provider.

2) Try using php. I know that might not sound like overkill, but php is really super useful and tons of fun once you learn it. There's probably more efficient ways of doing this, but on my website I do this:

PHP Code:
if (stristr($HTTP_USER_AGENT,"NETSCAPE")){
        echo 
"<META HTTP-EQUIV='refresh' content='0; url=netscape.php'>";
    }
    else {
    }  
/* rest of website */ 
Anyway, that's just me... I try to stay away from javascript as much as possible. Good luck.
nothingx is offline  
Old 02-10-2004, 07:24 PM   #18 (permalink)
Everything's better with bacon
 
SaltPork's Avatar
 
Location: In your local grocer's freezer.
n0nsensical, let me explain myself a little about not reccommending anyone code around or for Opera or Safari.

One of the things I do for work is help design and implement support systems for enterprise software rollouts. Sometimes this means implementing an HTML based help system and linking it context-sensitively to the application.

I don't author the content, but rather create the framework in which the content resides. Managing how that framework works is difficult when you consider 30,000 or more users on average will be using the framework that is being built. Taking into account every possible browser that people COULD use would create havoc with project timelines and increase the cost of the project to the point that it would be prohibitive for the customer to pay for it. That's why, in the business world that I live in, it is important to ignore the lesser used browsers, which is most assuredly what Opera and Safari are, and focus on the mainstream browser(s), which invariably ends up being IE 5.0 and later.

Very rarely have I encountered any need to support Netscape, although we do, but it's a HUGE pain in the ass. Further, I have only seen one instance where we needed to support Safari and that was in a university system and that added a couple of weeks to the timeline for development and QA.

So, from a realistic perspective, it's more than just stupid to support more than Netscape and IE, it's a waste of time and resources. If it's something you care to do, have a good time, but in the real world of business, it's not a cost effective strategy.


BTW, I'm glad I didn't piss you off before
__________________
It was like that when I got here....I swear.
SaltPork is offline  
Old 02-10-2004, 08:02 PM   #19 (permalink)
Junkie
 
Location: San Francisco
And I'm not saying special work should be done to support every browser on the planet either. The W3C already publishes standards that all browsers and websites should conform to. It usually seems to be Internet Explorer that doesn't follow them, and even though IE is the most widely used, I don't think asking for a standards-compliant version of a website is too much. I make the W3C version first and then make necessary changes for IE and only IE, just because it has to be supported. However even IE seems to do pretty well with standard pages. If other browsers have neither standards compliance nor a large userbase, then I agree, let 'em rot and render the pages incorrectly, but I still would never deny any browser completely like I've seen many sites do.
n0nsensical is offline  
Old 02-10-2004, 08:20 PM   #20 (permalink)
Everything's better with bacon
 
SaltPork's Avatar
 
Location: In your local grocer's freezer.
Quote:
Originally posted by n0nsensical
And I'm not saying special work should be done to support every browser on the planet either. The W3C already publishes standards that all browsers and websites should conform to. It usually seems to be Internet Explorer that doesn't follow them, and even though IE is the most widely used, I don't think asking for a standards-compliant version of a website is too much. I make the W3C version first and then make necessary changes for IE and only IE, just because it has to be supported. However even IE seems to do pretty well with standard pages. If other browsers have neither standards compliance nor a large userbase, then I agree, let 'em rot and render the pages incorrectly, but I still would never deny any browser completely like I've seen many sites do.
Point taken, understood and agreed with.

However, once you introduce Javascript, it starts getting really messy supporting other browsers and can snowball until it becomes a beast. That was where I was coming from....boy, we've come a long way from answering Boco's question, haven't we?
__________________
It was like that when I got here....I swear.
SaltPork is offline  
Old 02-10-2004, 08:24 PM   #21 (permalink)
Junkie
 
Location: San Francisco
Quote:
Originally posted by wrkime
Point taken, understood and agreed with.

However, once you introduce Javascript, it starts getting really messy supporting other browsers and can snowball until it becomes a beast. That was where I was coming from....boy, we've come a long way from answering Boco's question, haven't we?
Yes, it can, and yes, we have. And I don't even want to think about debugging all that JavaScript...
n0nsensical is offline  
Old 02-10-2004, 11:42 PM   #22 (permalink)
Upright
 
Location: BC, Canada
you could use "internal_redirect" 's with apache and mod_perl. now i know that is not what you were asking for but it would be easier and lot less stressful. you would take the HTTP_USER_AGENT environment var and compare it to a hash of known browsers, then pull a
Code:
$r->internal_redirect($redirect_var);
and it would seem to the user that the page never redirected. this is server side, using mod_perl and apache but personally i think it would work a lot better. also Dreamweaver has javascripts like the one you were talking about installed as ready to use "behaviours".
__________________
- 42 -
ni42 is offline  
Old 02-25-2004, 02:49 PM   #23 (permalink)
Crazy
 
Location: N.Ireland
I would help you BoCo but im much too afraid you wont appreciate it

Quote:
Originally posted by n0nsensical
The W3C already publishes standards that all browsers and websites should conform to. It usually seems to be Internet Explorer that doesn't follow them, and even though IE is the most widely used, I don't think asking for a standards-compliant version of a website is too much. I make the W3C version first and then make necessary changes for IE and only IE, just because it has to be supported. However even IE seems to do pretty well with standard pages. If other browsers have neither standards compliance nor a large userbase, then I agree, let 'em rot and render the pages incorrectly, but I still would never deny any browser completely like I've seen many sites do.
Well said!
blackcow is offline  
 

Tags
browser, redirect

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 06:39 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360