TNC*_*TNC 19
如果iOS/android的样式表相同,你可以这样做.
<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="css/mobile.css" type="text/css" />
但是如果你想要检测它是iOS还是Android,那么你需要进行检测.
在使移动开发更容易的方面,有很多东西:
有几个让你开始:)
希望这可以帮助.
试试这个,在 JavaScript 中使用 navigator.userAgent ;)(感谢这篇很棒的帖子http://css-tricks.com/snippets/javascript/redirect-mobile-devices/):
if ((navigator.userAgent.match(/iPhone/)) || (navigator.userAgent.match(/iPod/))) {
alert("we've got an iDevice, Scotty");
}
if (navigator.userAgent.match(/Android/)) {
alert("Droid me baby");
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
40227 次 |
| 最近记录: |