Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我设计了一个也可以通过桌面访问的 iPhone Web 应用程序。当它仅适用于 iphone 时,该设计在浏览器上崩溃了。如何阻止用户从桌面浏览器和仅 iPhone 访问?
使用 CSS 媒体查询隐藏特定大小以上屏幕的内容,将其替换为仅移动站点的消息。
如果你想使用javascript,你可以使用
var isIOSDevice = /(iPad|iPhone|iPod)/g.test( navigator.userAgent ); // will be true or false
如果你只想要 iPhone 然后删除 iPad 和 iPod
如果isIOSDevice不是真的,那么您可以将它们重定向到您的桌面友好页面。
isIOSDevice