简体   繁体   English

如何为2个用户代理加载自定义样式表?

[英]How to load a custom stylesheet for 2 useragents?

I have two user agent strings: 我有两个用户代理字符串:

Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3

Mozilla/5.0 (iPad; U; CPU OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5

The first targets iOS5 and the second targets iOS4. 第一个针对iOS5,第二个针对iOS4。

Is it possible to load a custom stylesheet for the first user agent string, then a different one for the later user agent string? 是否可以为第一个用户代理字符串加载自定义样式表,然后为后一个用户代理字符串加载不同的样式表?

本教程应该会有所帮助,它会详细说明: http : //davidwalsh.name/detect-ipad

如果您使用php ,只需检查$_SERVER['HTTP_USER_AGENT']所需的值,然后将<link href="yourstyle.css" rel="stylesheet" type="text/css">放置在head标签中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM