Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Detect Mac Browser

by Lhamo Latso (Scribe)
on Oct 02, 2003 at 20:00 UTC ( [id://296062]=note: print w/replies, xml ) Need Help??


in reply to Detect Mac Browser

You could also use the $ENV{} hash to access the brower string. The user agent/browser info is stored in $ENV{HTTP_USER_AGENT}. Your code would change to :

my $browser = $ENV{HTTP_USER_AGENT};

I use this little program to see what is available on the different browsers that I test.

#!/usr/bin/perl ## ## printenv -- print the environment ## print "Content-type: text/plain\n\n"; foreach $var (sort(keys(%ENV))) { $val = $ENV{$var}; $val =~ s|\n|\\n|g; $val =~ s|"|\\"|g; print "${var}=\"${val}\"\n"; }

Replies are listed 'Best First'.
Re^2: Detect Mac Browser
by Aristotle (Chancellor) on Oct 02, 2003 at 20:02 UTC
    That's exactly the value he gets by calling CGI.pm's user_agent function.

    Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://296062]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2025-03-17 05:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (54 votes). Check out past polls.