@akkadu/browser-info

This modules purpose is to help provide specific browser information for us to use. It has two main purposes

Usage no npm install needed!

<script type="module">
  import akkaduBrowserInfo from 'https://cdn.skypack.dev/@akkadu/browser-info';
</script>

README

Description

This modules purpose is to help provide specific browser information for us to use. It has two main purposes

Detect browser env

This module returns browser information based upon a widely used ua parser ua-parser-js

Some Chinese browsers are not supported by the module, so they are filled in manually for now. These include

  • Wechat browser
  • Huawei browser or Huawei phone
  • Sogou browser

The information returned includes

  • browserName:string
  • browserVersion:number
  • osName:string
  • osVersion:number
  • isMobile:boolean
  • isSafari:boolean
  • isIos:boolean
  • isMac:boolean

Detect if browser is online

This is a non trivial task, because window.online methods behave differently on Firefox and Chrome. In addition other browsers do not implement said api at all. Hence the only reliable way to detect if a browser is online or offline is to query a real life object, which in our case is a tiny s3 object served through our CDN.