XtGem Forum catalog

9Site. Xtgem.Com

HOME | Sexy Girl | Java | Android | Wapmaster
HomeWapmastersWapmasters
Search
▲ Simple function to detect mobile browser with PHP
** ccCrazy admin
03-02-2016
Just a simple function todetect if the visitor is using mobile or not. We are gonna do it with the help of regex. This function will returntrueif the visitor is using mobile browser andfalseif not. You can use it for several works. Like redirecting the visitors to mobile version or display an element.
The Function
Copy Code:

The explanation
Look carefully to the function. First of all we are collecting theuseragent stringin the variable$ua.Then we added few regex in$_mac_regex. They are taken from the mobile browser’suseragent strings.Next we have checked if the useragent matches with the regex. If it does then we returntrueotherwisefalse.
Sample Usage
Copy Code:

thank to Miraz.
▲ View: 162
- Share:
BBCode:

Link:
Random Topic
Module like facebook status v2
GocPho.Biz JohnCMS Version
ZWars Online Game Shared
PHP v1.3 Chat Script
JohnCMS 6.2 Mod
true
9site.xtgem.comHome
Textlink:WapViet.Vni.Mobi- Forum Giải Trí Với Nhiều Điều Thú Vị Đang Chờ Đón Bạn!Auto BOT FB VN