Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsDiscussion Forum → Get Firefox script HTML?
Get Firefox script HTML?
2009-05-19, 4:43 PM #1
If anyone tells me a script I can use for the site to detect the user's browser and in case of IE say "GET FIREFOX," that would be greatly appreciated. Thanks! Cheers!

http://intuitive-ds.com/max/index.html
幻術
2009-05-19, 4:48 PM #2
javascript

http://www.w3schools.com/js/js_browser.asp
"Nulla tenaci invia est via"
2009-05-19, 5:02 PM #3
Was kind of hoping there was a different way of doing it other than through javascript. Thanks for the link, though. Already got a script up and running.
幻術
2009-05-19, 5:04 PM #4
I do, gimme a sec..
Code:
<HEAD>
[whatever you already have]
	<!--[if IE]>
		<style type="text/css">
			#firefox { visibility: visible; }
		</style>
	<![endif]-->
</HEAD>

Where #firefox is a DIV with a small Get Firefox logo that's normally set to not display. I've got other CSS redefinitions in there on my site, there may be a shorter way to do that.
$do || ! $do ; try
try: command not found
Ye Olde Galactic Empire Mission Editor (X-wing, TIE, XvT/BoP, XWA)
2009-05-19, 5:10 PM #5
Ahh, so you're one of those web designers, huh? Have fun with that.
2009-05-19, 6:40 PM #6
PHP and any server side scripting can do it, you'll want to inspect the User-Agent request header and look for string fragments that indicate it is IE.

It is more reliable to do it server side since client side scripting may be disabled or not present at all, so it's best to use server-side scripting whenever possible.

[Edit: Actually DarkJediBob's might be better since it doesn't matter if the user agent has been altered or not... Though I probably wouldn't use visibility, I'd have two divs, one for the other browsers' text, one for IE only. I'd do display: none on the IE only one, and have the IE conditional block reverse the display attribute on the two blocks (setting the IE one to block, setting the other one to none). Or something like that.]

2009-05-19, 6:42 PM #7
Originally posted by Koobie:
Was kind of hoping there was a different way of doing it other than through javascript. Thanks for the link, though. Already got a script up and running.


Your right, I would do it in PHP. Using $_SERVER['HTTP_USER_AGENT'] variable, which would output something like "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5" giving you the info needed to determine the browser.
"Nulla tenaci invia est via"
2009-05-19, 6:59 PM #8
That sort of script is infinitely annoying by the way. A good way to just keep people from visiting your site.
2009-05-19, 8:42 PM #9
You know. You could just write a site that works in IE.
2009-05-19, 9:24 PM #10
JM's suggestion is the one I use in my sites. :p

It's not too hard if you use XHTML. Even IE6 support is not too hard if you avoid alpha blended PNGs (though I tend to target IE7 at least).

2009-05-20, 12:01 AM #11
Don't do it. But if you must, do it the way darkjedibob said. Conditional comments are the most sure-fire way of doing these things
Detty. Professional Expert.
Flickr Twitter
2009-05-20, 10:56 AM #12
I display a notice to IE6 and IE 5.5/5.0 users (Yes there are still people using IE5.0) telling them to upgrade. Not to firefox, I link to the IE7 download page.

Ideally i'd list IE/Firefox/Opera/Chrome but if someone is still using IE6 or lower, they're going to be meaningless and when given choices they don't understand people are less likely to upgrade as they get confused and just don't bother.

Displaying a "Get firefox" message to all IE users isn't a good idea, a lot of people don't know what a "web browser" is and wouldn't understand it can be upgraded (I can just imagine trying to explain the concept to my grandmother) or even notice a difference between versions. Anyone in this category, even if they did install firefox would likey open it up, immediately miss their bookmarks/settings, realise they're not logged in to anything and would go straight back to IE.
TheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWho
SaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTh
eJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSa
ysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJ
k
WhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSays
N
iTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkW
2009-05-20, 11:23 AM #13
but how do i get to the internet without AOL?
My girlfriend paid a lot of money for that tv; I want to watch ALL OF IT. - JM

↑ Up to the top!