-
Using php Function
Hello guys,
I wanna ask, how to know If the visitor to my website using a mobile phone or PC? using php function
Any answers as fast as possible
Thnx
-
-
It's not possible to know for sure. You can check the user agent as sent by the browser (might be missing or fake) with $_SERVER['USER_AGENT']
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
-
what's your purpose (why do you need to know)? if you're redirecting mobile users to a mobile version of your website, can check for known mobile browser UA strings and redirect them when found. It won't catch all of them (there are constantly new ones), and some might be PC browsers that have a similar UA string (shouldn't happen often, maybe not at all).
And of course (as Daniel says), the UA can always be missing, wrong, or faked.
The best option (if this is your purpose) is to put a link in the top left corner of your site that allows users to switch between your mobile and full-size sites at will. Mobile users will remember to bookmark the mobile version next time.
If this isn't what you're doing, let us know.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks