IBM Worklight 5.0.6.1 - 移动浏览器模拟器 - 用于navigator.network.connection.type与navigator.connection.type的WL.Device.getNetworkInfo [英] IBM Worklight 5.0.6.1 - Mobile Browser Simulator - WL.Device.getNetworkInfo for navigator.network.connection.type vs. navigator.connection.type

查看:379
本文介绍了IBM Worklight 5.0.6.1 - 移动浏览器模拟器 - 用于navigator.network.connection.type与navigator.connection.type的WL.Device.getNetworkInfo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在MBS以及iOS和Android设备上看到了不同的行为。

We see a different behavior in the MBS and on our iOS and Android devices.

在模拟器中:


  • navigator.network.connection.type返回模拟器菜单中定义的值(这是旧的API并且已弃用)。

  • navigator.connection.type未定义(这是新的,很快就是官方API)。

在设备上:


  • 两者都返回正确的值(不推荐使用的API和新的API)

这意味着以下电话:

WL.Device.getNetworkInfo(function (networkInfo) {
  alert (networkInfo.ipAddress); 
  }
);




  • 收到 undefined MBS中的networkInfo对象。

  • 在设备上接收具有正确值的对象。

    • Receives an undefined networkInfo object in the MBS.
    • Receives an object with the right value on the devices.
    • 推荐答案

      我不确定为什么这在MBS中有效(而且不起作用),但请注意 WL.Device.getNetworkInfo API方法是仅在iOS和Android中支持

      I'm not sure why this works (and not works) in the MBS, but please do note that the WL.Device.getNetworkInfo API method is supported only in iOS and Android.

      这篇关于IBM Worklight 5.0.6.1 - 移动浏览器模拟器 - 用于navigator.network.connection.type与navigator.connection.type的WL.Device.getNetworkInfo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆