Re: [PHP] Browser Detection another page
On Fri, Feb 13, 2004 at 08:01:00PM +, Stuart wrote: > [EMAIL PROTECTED] wrote: > >Before you read my comments below, let me say that I'm not trying to prove > >you *wrong* or even express disagreement with the points you made; I'm > >just interested in your reasons. > > An interesting topic, but the OP was checking if the client was a PDA. > Maybe it's just me, but I feel that serving a site that wasn't designed > for viewing on PDAs to PDAs is generally a bad thing. True, PDAs can't generally handle the same size/number of graphics that a desktop browser can. But what about the Treo? The Sidekick? The Zaurus? Do those get browser-detected as well? Or will they still get the same designed-for-desktop site that all non-WinCE devices get? As an alternative, use the same (X)HTML, and design an alternate stylesheet for handhelds, using the CSS media type options: http://www.w3.org/TR/REC-CSS2/media.html#media-types Now you can maintain the same content, and just have two different stylesheets. 'Course, this is the ideal; it's probably the case that not all handheld browsers recognize media="handheld" like they should. Perhaps the @import rule trick will work, as well. There is some discussion on alistapart: http://www.alistapart.com/articles/slashdot2/ about handheld emulators, and how XHTML/CSS-designed sites appear on them. However, this is way way OT now, and should probably be carried on offlist. Or, better yet, I bet css-discuss can provide tips for using CSS to support handheld browsers, without having to duplicate content or do browser sniffing. -- [ joel boonstra | gospelcom.net ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser Detection another page
[EMAIL PROTECTED] wrote: Before you read my comments below, let me say that I'm not trying to prove you *wrong* or even express disagreement with the points you made; I'm just interested in your reasons. An interesting topic, but the OP was checking if the client was a PDA. Maybe it's just me, but I feel that serving a site that wasn't designed for viewing on PDAs to PDAs is generally a bad thing. -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser Detection another page
[ straying OT, so apologies in advance. ] [ also, quite long. double apologies. ] On Fri, Feb 13, 2004 at 10:29:07AM -0200, [EMAIL PROTECTED] wrote: > > Hopefully you're aware that $HTTP_USER_AGENT is an unreliable variable, > > in that it is sent by the client, and can contain virtually anything. > > Sure, but why would a user want to fake their browser signature? The > worst that could happen is that the offending user would be redirected > to a page that wouldn't look good in her/his browser. Or am I missing > something here? As speculated by Richard Davey: "Although I can't give a specific example, I bet there are some firewalls out there that filter this information out too." I can give a specific example -- Norton Firewall, included with the Norton Internet Security package. An old script of ours (not one I wrote ;) was relying on HTTP_USER_AGENT to do some form interaction, and every so often I would get emails saying that users had received the error page. I couldn't find any connection, until one person happened to mention that they use Norton Firewall product. Sure enough, every person after that that had this problem also (when asked) mentioned that they used Norton Firewall. You can, of course, override Norton's settings. But nobody does that. > > I saw a response letting you know how to do this, but I would > > recommend not sending people to different pages based on which > > browser/OS they're using. > > Why not? Isn't that what most of the big web sites do? If most big web sites jumped off a bridge... okay, sorry, that was dumb. I don't have the numbers/stats/whatever to say whether or not most big websites do or don't do this. However... Are you a big website? Do you have the resources/manpower to maintain two separate versions of each page in your site? Three? Ten? How do you decide when to stop creating OS- or browser-specific versions of your websites? To bring PHP back into this, yes, PHP could lend a hand with some of this. However, you will clearly be doing more work. And what about those browsers with special needs that you *don't* anticipate? What happens to those folks? If your classes of browsers are: - IE/Windows (NT, 2k, 98, XP) - Windows CE - everything else Then where does a user using the JAWS screen reader get sent? My guess is they end up on "everything else", which (again, my guess) is going to try to be a lowest-tech page that attemps to cater to everyone. Will that page be able to be read by JAWS? In 10 years, will the situation be getting better or worse? Will there be only two browsers to code for, or fifty? Do you want to keep trying to code to the idiosyncrasies of each popular new browser that comes out? > > It should be possible to use CSS/(X)HTML to present your content in a > > way that is accessible to whichever browser accesses your site. IMHO, > > browser-sniffing to serve different content is a bad idea. > > What about obsolete browsers that don't handle CSS too well (or not at > all)? We developers would love to have all our visitors use the most > recent browsers, preferably ones with a good implementation of the > JavaScript DOM and XSLT transformations, but that's unfortunately not > what happens in the real world. I agree, it'd be swell if all my users used the latest Mozilla. But you're right, of course -- they don't. And many won't ever upgrade until they get a new OS. So, what's a developer to do? What you first need to decide is what you consider "browser compatibility". By that do you mean that your design needs to look exactly the same in every conceivable browser + OS combination? Or are you more concerned about your users being able to get information and navigate the site? Can you have both? No. It's not possible. Can you make the site look good for 90% of your users, and work well for 100%, all with only one site? Yes. I love this site: http://csszengarden.com/ The exact same HTML is used for each design. The only change is the CSS. Each design in the gallery must work for a majority of major browsers. Head over there, and check it out in IE6/Win, and Mozilla. Browse through a few designs. Then try it out in Netscape 4.x. Your cellphone. NCSA Mosaic. You can browse the site in all of them. The relatively small number of users who use old/incapable browsers: http://www.thecounter.com/stats/2004/January/browser.php can still use the site. Users with modern browsers get beautifully-designed sites, all with the same HTML. Now try using all of those browsers on some of the big websites that do browser sniffing. A real-world gallery: http://cssvault.com/ shows sites that are actually live on the web, using CSS to style their content. And there are indeed some big sites that have decided that a CSS design is viable: http://msn.espn.go.com/ http://news.com.com/ http://www.sprintpcs.com/ I'm not an expert (unfortunately) on the specifics of how to acheive
Re: [PHP] Browser Detection another page
Hello Joel, Before you read my comments below, let me say that I'm not trying to prove you *wrong* or even express disagreement with the points you made; I'm just interested in your reasons. On 12 Feb 2004 at 20:11, joel boonstra wrote: > Hopefully you're aware that $HTTP_USER_AGENT is an unreliable variable, > in that it is sent by the client, and can contain virtually anything. Sure, but why would a user want to fake their browser signature? The worst that could happen is that the offending user would be redirected to a page that wouldn't look good in her/his browser. Or am I missing something here? > I saw a response letting you know how to do this, but I would > recommend not sending people to different pages based on which > browser/OS they're using. Why not? Isn't that what most of the big web sites do? > It should be possible to use CSS/(X)HTML to present your content in a > way that is accessible to whichever browser accesses your site. IMHO, > browser-sniffing to serve different content is a bad idea. What about obsolete browsers that don't handle CSS too well (or not at all)? We developers would love to have all our visitors use the most recent browsers, preferably ones with a good implementation of the JavaScript DOM and XSLT transformations, but that's unfortunately not what happens in the real world. Could you throw in another 2 cents? :o) Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser Detection another page
On Fri, Feb 13, 2004 at 11:57:59AM +1100, PETCOL wrote: > Then I need to take the user to another page. > > > if (strstr($HTTP_USER_AGENT,'Windows CE')) { > //go to the Windows CE version of the site > } else { > // go to or Stay on the large version > } > > ?> Hopefully you're aware that $HTTP_USER_AGENT is an unreliable variable, in that it is sent by the client, and can contain virtually anything. I saw a response letting you know how to do this, but I would recommend not sending people to different pages based on which browser/OS they're using. The most I would use $HTTP_USER_AGENT for is if I'm presenting a list of different OSes (say, for links to OS-specific downloads), and I want to select an intelligent default. It should be possible to use CSS/(X)HTML to present your content in a way that is accessible to whichever browser accesses your site. IMHO, browser-sniffing to serve different content is a bad idea. -- [ joel boonstra | gospelcom.net ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser Detection another page
Hello PETCOL, Friday, February 13, 2004, 12:57:59 AM, you wrote: P> I have been able to work out how to detect the browser I'm looking for. P> Then I need to take the user to another page. P> if (strstr($HTTP_USER_AGENT,'Windows CE')) { P> //go to the Windows CE version of the site P> } else { P> // go to or Stay on the large version P> } if (strstr($HTTP_USER_AGENT, "Windows CE")) { Header("Location: http://www.yoursite.dom/ce_page.php";); exit; } else { Header("Location: http://www.yoursite.dom/another_page.php";); exit; } -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser detection
probably your browscap.ini is outdated or missing. On Wed, 3 Apr 2002 13:53:15 -0500, Joshua E Minnie wrote: >Can anybody tell me why, when running on the same browser, I get 2 >different >outputs. > >This is the output when I echo $HTTP_USER_AGENT:Mozilla/4.0 >(compatible; MSIE 6.0; Windows NT 5.0) > >This is the output when I use get_browser(): > > browser_name_pattern.Mozilla/4\.0.* > parent...Netscape 4.00 > browser..Netscape > version..4.00 > majorver.4 > minorver.00 > frames...1 > tables...1 > cookies..1 > backgroundsounds. > vbscript. > javascript...1 > javaapplets..1 > activexcontrols.. > beta.1 > > >I am using IE 6.0 running PHP 4.1.2 binary for Windows. >-- >Joshua E Minnie >CIO >[EMAIL PROTECTED] > >"Don't work for recognition, but always do work worthy of >recognition." > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] browser detection
Check out the following : Browser Detection and Appropriate CSS Generation: - http://www.phpbuilder.com/columns/tim2821.php3 phpSniff: - http://www.sourceforge.net/projects/phpsniff/ And as already stated, the predefined variable $HTTP_USER_AGENT is what makes all this happen. Predefined variables are good : http://www.php.net/manual/en/language.variables.predefined.php That phpbuilder article will probably be of most use to you, it contains examples to do about anything with $HTTP_USER_AGENT. Also, check out the get_browser() function : http://www.php.net/manual/en/function.get-browser.php Although it takes a little work to get running :) Regards, Philip Olson On Tue, 25 Sep 2001, wm wrote: > hi all, > > anybody know the function for browser detection? > > what i want to do is set a variable $spacerheight to a value dependent > upon whether the user is on a mac or a pc. > > then i can say height= in the html. > > i tried using javascript a few diff ways with this and it didn't work. > > so, if anybody knows that function or if there is another way, please > let > me know. > > thanks. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] browser detection
print "$HTTP_USER_AGENT"; will print the browser the person is using. Tyler Longren Captain Jack Communications [EMAIL PROTECTED] www.captainjack.com - Original Message - From: "wm" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 25, 2001 5:54 PM Subject: [PHP] browser detection > hi all, > > anybody know the function for browser detection? > > what i want to do is set a variable $spacerheight to a value dependent > upon whether the user is on a mac or a pc. > > then i can say height= in the html. > > i tried using javascript a few diff ways with this and it didn't work. > > so, if anybody knows that function or if there is another way, please > let > me know. > > thanks. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] browser detection
hello. you can use the $HTTP_USER_AGENT variable for that. for example: $spacerheight = 2; // default if (strstr($HTTP_USER_AGENT, "Mac")) { $spacerheight += 4; } hope that helps. --- wm <[EMAIL PROTECTED]> wrote: > hi all, > > anybody know the function for browser detection? > > what i want to do is set a variable $spacerheight to > a value dependent > upon whether the user is on a mac or a pc. > > then i can say height= in > the html. > > i tried using javascript a few diff ways with this > and it didn't work. > > so, if anybody knows that function or if there is > another way, please > let > me know. > > thanks. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > __ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Browser Detection & Redirection -- PHP or Apache ???
the $HTTP_USER_AGENT variable will be of some use to you. -- Tyler Longren Captain Jack Communications [EMAIL PROTECTED] www.captainjack.com On Fri, 17 Aug 2001 16:14:40 -0500 Christopher Raymond <[EMAIL PROTECTED]> wrote: > > PHP Folks: > > Does PHP provide some mechanism for browser detection & redirection or > is > this something that Apache Directives can handle? > > For example: I don't want users with browsers less than 4.0 to actually > load > a page on our site. Instead, I want them redirected to a page that let's > them know their browser is in-compatible. > > I know this is something JavaScript can do, but again that relies on the > browser. > > > Thanks for any help, > > Christopher Raymond > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Browser Detection
> Is it possible with PHP (3.0.16) to detect which browser a user has and > then load an image based on the browser type? I've found the get_browser() > command in the manual, but it doesn't look like that does what I want, or I > could just be looking at it wrong. > > Has anyone tried this before? and if so, could you provide some assistance. get_browser() only works in conjunction with a nice big fat browscap.ini file you need to snarf from somewhere. Probably easier to look at $HTTP_USER_AGENT variable and ereg_match() to determine what browser it is -- Depending on just how fine-tuned you need to check. Check the output from using a couple browsers. -- WARNING [EMAIL PROTECTED] address is not working -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]