最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Mobile site detection server side vs client side - Stack Overflow

programmeradmin2浏览0评论

Can anyone remend the best way to detect mobile device accessing a site - we want to re-direct to a mobile version rather than restyle the existing page due to CMS restrictions.

We also need the option to be able to return to the full site on mobile if requested.

We have a server, but aren't developers so would have to pay for dev work to be done server side - we are just wondering the best method to use.

Can anyone remend the best way to detect mobile device accessing a site - we want to re-direct to a mobile version rather than restyle the existing page due to CMS restrictions.

We also need the option to be able to return to the full site on mobile if requested.

We have a server, but aren't developers so would have to pay for dev work to be done server side - we are just wondering the best method to use.

Share Improve this question edited Apr 20, 2012 at 14:49 Crab Bucket 6,2779 gold badges41 silver badges73 bronze badges asked Mar 6, 2012 at 15:51 DancerDancer 17.7k40 gold badges131 silver badges213 bronze badges
Add a ment  | 

6 Answers 6

Reset to default 5

take a look at this URL: http://detectmobilebrowsers./

they have code for both server side and client side (jQuery/JavaScript).

If by directing to a mobile version you mean just a design change specific to mobile and not functionality changes for mobile users, then look into Responsive design which dynamically changes your design based on resolution of the current users view using media queries.

Media Queries Spec W3C

Responsive Design Guidelines

This approach should not be limited by any kind of CMS as it is straight CSS use.

See below link i have answered here it might help you. same question as you asked Dear Paul.

Auto Mobile Site Redirect

Snippets for below are present on above link.

  • Detecting Smartphones Using JavaScript
  • Detecting Mobile Devices Using PHP
  • iPhone & iPod Detection Using JavaScript
  • Detect mobile.js and github etc.

As pritaes suggested, I'd remend WURFL. The new cloud-based detection service is now available with free accounts and new capabilities like "jqm_grade", which tells you the jQuery Mobile Grade (support level), so you know what type of content to serve before sending it to an unsupported device.

Personally, for server side detection I like WURFL. It has a .NET API available.

There are open source options that arn't cloud based if you want something you have more control over. 51Degrees.mobi are worth checking out. They have implementations in PHP, C, as well as a few others. I've used them before now and found them to be pretty good. There's also a really in depth article on the Nokia developers website about device detection that's worth a read.

发布评论

评论列表(0)

  1. 暂无评论