使用 51Degrees.mobi Foundation 检测选项卡
我正在尝试使用 51Degrees.mobi Foundation 库检测 Ipad 或 Samsung Galaxy Tab 或任何其他选项卡。
我正在使用 Request.Browser["is_tablet"] 但它返回错误。有谁知道这是已知问题还是我犯了一些错误。
我正在使用 Opera 移动模拟器对此进行测试,
您能给我下载 iPad 模拟器的 URL 吗?
我在下面再次描述我的问题——
我在我的 MVC 应用程序中使用 51Degrees.mobi Foundation。当我在视图引擎中使用 Request.Browser["is_tablet"] 检查请求是否来自选项卡时,结果为 false。 Samsung Galaxy Tab(Opera 移动模拟器)和 Ipad(AIRiPad 模拟器)会发生这种情况。
在这种情况下,Request.Browser.IsMobileDevice 和 Request.Browser["is_wireless_device"] 也会返回 false。因此,为桌面设计的常规 MVC 视图将会被加载。 我没有在配置文件中使用位置,因为当请求来自手机或平板电脑时,我需要从视图引擎重定向到适当的视图。
让我知道 is_tablet 是否存在任何已知问题,或者我是否以错误的方式进行操作,或者模拟器是否存在问题?
I am trying out to detect the Ipad or Samsung Galaxy Tab or any other Tab using 51Degrees.mobi Foundation library.
I am using Request.Browser["is_tablet"] but it is returning me false. Is there any one who knows if this is the known issue or I am making some mistake.
I am testing this using Opera Mobile Emulator
can you give me URL to download the simulator for iPad?
I am describing again my issue below--
I am using 51Degrees.mobi Foundation in my MVC application. When I use Request.Browser["is_tablet"] in my View Engine to check if request is from tab, its giving me false as a result. This is happening for Samsung Galaxy Tab(Opera Mobile Emulator) and Ipad (AIRiPad emulator).
In this case the Request.Browser.IsMobileDevice and Request.Browser["is_wireless_device"] is also returning false. Hence the regular MVC views designed for desktop is getting loaded.
I am not using Locations in config file as I need to redirect to appropriate views from my view engine when request is from mobile or tablet.
Let me know is there any knows issue with is_tablet or Am I doing it wrong way or is there issue with emulator?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用开源lite设备数据,那么您将无法检测平板电脑功能。但是,您可以检测设备是否是移动设备(IsMobile(布尔值))和屏幕尺寸(ScreenPixelsHeight(int)和ScreenPixelsWidth(int))。您可以通过使用这些值的组合来确定设备是否是平板电脑。
您可以使用属性字典此处检查可用属性。希望这有帮助。
If you are using the open source lite device data, then you won't be able to detect the tablet capability. You can however detect both whether the device is mobile (IsMobile (boolean)) and the screen size (ScreenPixelsHeight (int) and ScreenPixelsWidth (int)). You may be able to determine whether or not the device is a tablet by using a combination of these values.
You can check the avaliable properties using the property dictionary here. Hope this helps.
Request.Browser["is_tablet"] 对我来说效果很好:
使用 Blackbaud 实验室的 iPad 模拟器。
http://labs.blackbaud.com/NetCommunity/article?artid=662
用户代理:
Mozilla/5.0(iPad;U;CPU OS 3_2,如 Mac OS X;en-us)AppleWebKit/531.21.10(KHTML,如 Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10
检查您的日志文件 App_Data/Log.txt 中是否有此条目:
Info - Loaded 14691 devices using 12720 strings in 2295ms
将日志级别设置为在您的配置文件
<日志 logFile="~/App_Data/Log.txt" logLevel="调试"/>
Request.Browser["is_tablet"] works fine for me:
used the iPad simulator from Blackbaud labs.
http://labs.blackbaud.com/NetCommunity/article?artid=662
User-Agent:
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10
Check your logfile App_Data/Log.txt for this entry:
Info - Loaded 14691 devices using 12720 strings in 2295ms
set the log level to debug in your config file
< log logFile="~/App_Data/Log.txt" logLevel="Debug"/>