如何检测移动设备并获取用户代理信息只发送一次并将该信息保存到服务器上的数据库? [英] How to detect mobile device and get user agent info send and save that information to database on server, only once?

查看:139
本文介绍了如何检测移动设备并获取用户代理信息只发送一次并将该信息保存到服务器上的数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何脚本可以检查用户代理然后将该信息发送并保存到服务器上的数据库?

Is there any script to check user agent then send and save that information to database on server?

我正在制作移动网站,其中包含等2个版本m.facebook.com touch.facebook.com ,我想重定向到不同的手机。我使用 WURFL 设备检测。

I'm making mobile website with 2 versions like m.facebook.com and touch.facebook.com and I want to redirect to different mobiles. and I use WURFL device detection.

因此,例如m.html5version.com应该发送到所有支持HTML5的设备和 m .mobileversion.com 应该提供给所有其他手机。

So for example m.html5version.com should be delivered to all HTML5 supported devices and m.mobileversion.com should deliver to all other mobiles.

所以我需要一种方法来第一次使用任何服务器端或客户端检测设备和浏览器 - 方法。当任何用户第一次在设备上打开网站时,一旦应该收集有关设备和浏览器的信息,脚本应该运行,并且应该将信息保存在我现有的WURFL数据库中,所以下次当任何用户来自同一设备时,那么他将重定向到触摸或移动版网站,具体取决于设备。

So i need a way to detect device and browser 1st time using any server-side or client-side method. when any user will open the website first time on device then an script should run once it should collect the information about device and browser and should save the information in my existing WURFL database , so next time when any user will come from same device then he will redirect to touch or mobile version of website depending on device.

因此,只有第一次在第一台设备上我想检测设备并保存信息。

So only 1st time on 1st device I want to detect device and save the info.

有没有办法做到这一点?

Is there any way to do this?

例如

Android 1.6没有HTML5支持且仍在使用中。所以我想将所有Android 1.6设备重定向到 m.mobileversion.com 而不是 touch.mobileversion.com

Android 1.6 doesn't have HTML5 support and still in use. So i want to redirect all Android 1.6 devices to m.mobileversion.com not to touch.mobileversion.com

在触摸版的网站上我使用HTML 5标签,如< header> < footer> < nav> 等不支持Android 1.6。所以我想检测第一个从Android 1.6设备访问网站的设备,因为1.6中不支持HTML5所以用户代理应该保存在我的数据库中然后当下次任何用户打开网站时我会重定向自动下载移动版本,任何设备都不需要第二次检测。

And in touch version of website I'm using HTML 5 tags like <header>, <footer>, <nav> etc which is not supported Android 1.6. So i want to detect the first device who will access the website from Android 1.6 device and because HTML5 is not supported in 1.6 so user agent should be saved in my database then I when next time any user will open the website in 1.6 it will redirect to lo-fi mobile version automatically, no detection should be needed 2nd time for any device.

推荐答案

见下面的链接,这将是完全适合您的需要

see below link, this will perfectly suitable for your need

下面还有一个脚本:

这篇关于如何检测移动设备并获取用户代理信息只发送一次并将该信息保存到服务器上的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆