Javascript-tp framework development websites have PC and mobile versions. how can we automatically identify visitor devices and add them to different versions?

Source: Internet
Author: User
The tp framework development website has a PC version and a mobile version. how to automatically identify visitor devices? then, in different versions, my images seem to have a very short segment of Baidu code. but now I can find it again. don't go out. please tell us the simplest way. tp framework development websites have PC and mobile versions.

In my image, it seems that some very short Baidu code can be implemented, but now I can't find any more. please tell me the simplest way.

Reply content:

Tp framework development websites have PC and mobile versions. how can they automatically identify visitor devices and add them to different versions?

In my image, it seems that some very short Baidu code can be implemented, but now I can't find any more. please tell me the simplest way.

Navigator. userAgent. match (/AppleWebKit. * Mobile .*/)

Composer require mobiledetect/mobiledetectlib

Https://github.com/serbanghit...

Same answer: useragent

Github has
Mobile detect

You can also consider the self-adaptive css framework such as bootstrap.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.