使用 wurfl 将手机重定向到移动版本,同时 iPad/Playbook 和台式机获取该版本

发布于 2024-09-30 21:49:10 字数 306 浏览 1 评论 0原文

对于那些使用 wurfl 的人,我只是想检查一下我的逻辑是否正确。我有一个页面,有移动版和桌面版。

如果我希望 iPhone 等手机重定向到较小的移动版本,而 iPad、PlayBook 和台式机获得全尺寸版本,那么全尺寸页面上的逻辑是否正确:

if ($requestingDevice->getCapability("is_wireless_device ") == "true" && $requestingDevice->getCapability("is_tablet") == "false") { //重定向到手机版本 }

For those of you who use wurfl, I just wanted to check if my logic was correct. I have a page that has both a mobile and desktop version.

If I want phones like iPhones, etc to be redirected to the smaller mobile version while iPads, PlayBooks and desktops get the full size version, is this the correct logic on the full size page:

if ($requestingDevice->getCapability("is_wireless_device") == "true" && $requestingDevice->getCapability("is_tablet") == "false") {
//redirect to mobile version
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

物价感观 2024-10-07 21:49:10

你的逻辑是正确的。我建议您不要使用 wurfl 从移动版本切换到桌面版本。它会影响应用程序的性能。最好使用基于一组启发式的简单切换器从移动设备切换到桌面设备,然后仅在移动版本上使用 wurfl 来获取设备功能。

有很多代码可用于识别用户代理是否是移动用户代理。

Your logic is correct. I recommend you don't use wurfl to switch from mobile to desktop version. It penalize the application performance. It is better to use a simple switcher based on a set of heuristics to switch from mobile to desktop, and then use wurfl only ont he mobile version to obtain the devices capabilities.

There are a lot of code useful to recognize if a user-agent is a mobile user-agent.

七七 2024-10-07 21:49:10

您还可以检查“can_assign_phone_number”,它似乎可以正确过滤掉平板电脑并保留手机。

You can also check for "can_assign_phone_number" which seem to properly filter out tablet and keep phone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文