相关疑难解决方法(0)

如何检测IE11?

当我想检测IE时,我使用此代码:

function getInternetExplorerVersion()
{
  var rv = -1;
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
function checkVersion()
{
  var msg = "You're not using Internet Explorer.";
  var ver = getInternetExplorerVersion();

  if ( ver > -1 )
  {
    msg = "You are using IE " + ver;
  }
  alert( msg );
}
Run Code Online (Sandbox Code Playgroud)

但IE11正在返回"你没有使用Internet Explorer".我该如何检测它?

debugging internet-explorer browser-detection forward-compatibility internet-explorer-11

207
推荐指数
7
解决办法
22万
查看次数

已弃用的 Javascript 操作系统检测技术

我想知道为什么像navigator.userAgentnavigator.appNamenavigator.appVersionnavigator.platform这样的 javascript 操作系统检测技术正在从网络标准中删除。

https://developer.mozilla.org/en-US/docs/Web/API/Navigator

如果您访问每个导航器道具,您可以看到

已弃用

此功能已从 Web 标准中删除。尽管某些浏览器可能仍然支持它,但它正在被删除。不要在旧项目或新项目中使用它。使用它的页面或网络应用程序可能随时中断。

所以我想知道

  1. 为什么他们要删除这个
  2. 他们会引入一种新的操作系统检测方法吗
  3. 即使这些技术已被弃用,我也可以使用它们吗?

可能有很多情况我们需要知道操作系统版本。

javascript browser browser-detection navigator os-detection

13
推荐指数
1
解决办法
1万
查看次数


在javascript中的os和os版本检测

可能重复:
如何使用JavaScript查找操作系统版本

我如何能够检测到我的访问者在javascrtip中使用哪个os和os版本.例如windows vista或者七或者Xp和linux.

javascript

2
推荐指数
1
解决办法
8798
查看次数

如何使用 Angular2 和 Typescript 获取设备信息

我有一张表,我需要从打字稿中将这些详细信息填入我的表中。

1.Device Name
2. Device OS
3. Location
4. Browser
5. IsActive
Run Code Online (Sandbox Code Playgroud)

这些字段必须从打字稿中填写,所以任何人都可以帮我解决这个问题

windows navigator typescript angular

-1
推荐指数
1
解决办法
6118
查看次数