473,563 Members | 2,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to detect the client computer is using PC Browser / Mobile Browser?

Thanks
Jun 2 '08 #1
8 6519
NC
On May 13, 8:01 pm, "George" <@wrote:
>
How to detect the client computer is using PC Browser / Mobile
Browser?
By analyzing the content of $_SERVER["HTTP_USER_AGEN T"], which,
needless to say, can be missing or configured to say anything...

Cheers,
NC

Jun 2 '08 #2
On May 14, 4:01 am, "George" <@wrote:
Thanks
You could try looking at the user agent string and analysing that to
try and guess the browser, but in all honesty there's no 100% reliable
way to determine what browser the user is using. The user agent
string is sent by the browser but there's nothing preventing the
browser sending one that identifies it as a different browser from
what it actually is.

Why do you need to know what browser the user is using though? The
browser the user has should be irrelevant to what content they get
served. If you're attempting to get around browser rendering issues
(ie IE6 and its brain damaged CSS), then conditional comments in the
HTML is a better approach. Only IE recognises them, other browsers
ignore them, so you can use them to load IE specific stylesheets and
javascript to work around that browser's flaws.

Don't try using user agent analysis to lock certain browsers out of
your site! You're annoying users and driving them away, and those
determined enough and knowledgeable enough to spoof the user agent
string can get around any blocks you might put up any way.
Jun 2 '08 #3
On May 14, 6:01 am, "George" <@wrote:
Thanks
Hi,

You can see
http://techpatterns.com/downloads/ph..._detection.php

and

http://www.hostpc.com/community/showthread.php?t=1599

also

Think about this code and enjoy :)

<?php
//If principal is using a Palm, then set it for presentation changes,
etc.

$string = $_SERVER['HTTP_USER_AGEN T'];
$substring = 'Palm';
$pos = 0;
$pos = strpos($string, $substring, $pos);
if ($pos =='')
{
$isPalm="0";
}
else {
$isPalm="1";
}
?>

Jun 2 '08 #4
On 14 May, 09:16, Gordon <gordon.mc...@n tlworld.comwrot e:
Why do you need to know what browser the user is using though? The
browser the user has should be irrelevant to what content they get
served.
I think that the answer to this question is in the OP's original
question.

As with the mobile Google search page and lots of other pages, web
site designers recognise that viewing a page on a tiny mobile device's
screen is a very different experience to viewing it on a "standard"
computer monitor, quite apart from the connection speed differences
that are still commonly encountered between the 2 platforms.

I for one am very pleased that designers take this into account.

Do you build all your sites to look great on a 2.8inch screen and then
have vast areas of nothing on a PC monitor?
Jun 2 '08 #5
PHP-Arabia a écrit :
Think about this code and enjoy :)

<?php
//If principal is using a Palm, then set it for presentation changes,
etc.

$string = $_SERVER['HTTP_USER_AGEN T'];
$substring = 'Palm';
$pos = 0;
$pos = strpos($string, $substring, $pos);
if ($pos =='')
{
$isPalm="0";
}
else {
$isPalm="1";
}
?>
<?php
$isPalm = (strpos($_SERVE R['HTTP_USER_AGEN T'], 'Palm') !== false);
?>

$isPalm is false/true.
--
Guillaume
Jun 2 '08 #6
On May 14, 12:47 pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
On 14 May, 09:16, Gordon <gordon.mc...@n tlworld.comwrot e:Why do you need to know what browser the user is using though? The
browser the user has should be irrelevant to what content they get
served.

I think that the answer to this question is in the OP's original
question.

As with the mobile Google search page and lots of other pages, web
site designers recognise that viewing a page on a tiny mobile device's
screen is a very different experience to viewing it on a "standard"
computer monitor, quite apart from the connection speed differences
that are still commonly encountered between the 2 platforms.

I for one am very pleased that designers take this into account.

Do you build all your sites to look great on a 2.8inch screen and then
have vast areas of nothing on a PC monitor?
Could that not be accomplished with a stylesheet for mobile users
though? On reflection I can see that sending a mobile browser less
content is obviously a good thing given that they tend to have limited
bandwidth, but with clever site design the stylesheet should be able
to accomplish that.

I didn't fully appreciate the OP's question as he'd posted it into the
title and left his body more or less blank.
Jun 2 '08 #7
George escribió:
Thanks
You're welcome.

Oh, come on, don't write the whole question in the subject xD

Have a look at get_browser():

http://php.net/function.get_browser
http://browsers.garykeith.com/downloads.asp

You'll probably need to download the browser database
(lite_php_brows cap.ini should be okay) but it's far more accurate that
any home made browser sniffing of your own. Just fetch the
"isMobileDevice " property and let others do the research.

--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño MarÃ*a: http://www.demogracia.com
--
Jun 2 '08 #8
On 14 May, 15:37, Gordon <gordon.mc...@n tlworld.comwrot e:
On May 14, 12:47 pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
On 14 May, 09:16, Gordon <gordon.mc...@n tlworld.comwrot e:Why do you need to know what browser the user is using though? The
browser the user has should be irrelevant to what content they get
served.
I think that the answer to this question is in the OP's original
question.
As with the mobile Google search page and lots of other pages, web
site designers recognise that viewing a page on a tiny mobile device's
screen is a very different experience to viewing it on a "standard"
computer monitor, quite apart from the connection speed differences
that are still commonly encountered between the 2 platforms.
I for one am very pleased that designers take this into account.
Do you build all your sites to look great on a 2.8inch screen and then
have vast areas of nothing on a PC monitor?

Could that not be accomplished with a stylesheet for mobile users
though? On reflection I can see that sending a mobile browser less
content is obviously a good thing given that they tend to have limited
bandwidth, but with clever site design the stylesheet should be able
to accomplish that.
I don't see how the stylesheet could limit the amount of content being
sent.
Jun 2 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3332
by: ripken95 | last post by:
I connect to the internet through ADSL. I want to write the web page which can detect the connection status with javascript. This detection is like the signal detection in the mobile phone. If the signal is weak, the status may have one squares or zero on the phone. How could I do if I want to detect the status of the network? Thx and Best...
2
1563
by: Joe Abou Jaoude | last post by:
hi, in my web app, I need to detect if a client computer is a Mac. i thought to use Request.Browser.Platform, however i don't have a Mac to test on it, so i have no idea what I'll get in result. can anyone help ? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
1
3179
by: onewebclick | last post by:
Is there a way to detect a browser cache is full using javascript or HTML thorugh a web page and inform the user to clear the cache to improve performance of the website. It looks like google's gmail use to detect and warn "Gmail says my browser's cache is full" http://gmail.google.com/support/bin/answer.py?answer=14106 then there should...
3
9094
by: Sara | last post by:
HI, I want to code a program to detect GSM mobile (any kind) which connected through serial port to computer and then be able to send SMS through this mobile phone to other mobile phones, could anyone help me and guide me, I wrote a program which could open COM port but still couldn't detect mobile phone and send SMS through it. I searched...
6
5214
by: hb | last post by:
Hi, Would you please tell me how to detect if the client's browser is closed? I need such event to trigger a database modification. Thank you hb
4
7000
by: Sara | last post by:
Hi I want to code a program which could send SMS through web page to mobile phone, but because there is no Service here such as SMPP , therefore I have GSM mobile phone which connected directly to the server which run these aspx pages. now my question is 1- how to detect this mobile phone which connected through serial ports 2- how I could...
11
4111
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I have an aplication web asp.net 2.0 and I am Trying to detect the close event in browser, which is the best performance for do this ? What's up with Alt+F4, Refresh, user clicks X, etc ? Thanks. -- http://www.alhambra-eidos.es/web2005/index.html www.kiquenet.net
22
2872
by: Dan Rumney | last post by:
Hi all, I've been writing Javascript for quite a while now and have, of late, been writing quite a lot of AJAX and AJAX-related code. In the main, my dynamically generated pages are created using Perl on the backend, with Javascript providing limited frontend functionality. As an example, an expanding tree would be fully populated on the...
1
4667
by: s3raph | last post by:
Hi, I'm having trouble detecting the client machine connection lost when the client physically pushes the power or restart button on their computer. Using the code from Plater in the following thread: http://bytes.com/topic/net/answers/828133-c-net-detecting-socket-closed I have managed to detect disconnect by the client when the client...
0
7659
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7945
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.