Detect if user is using webview for android/iOS or a regular browser

后端 未结 10 2205
迷失自我
迷失自我 2020-11-28 07:27

How to detect if the user is browsing the page using webview for android or iOS?

There are various soluti

10条回答
  •  囚心锁ツ
    2020-11-28 07:52

    I found this simple-to-use package is-ua-webview

    intall: $ npm install is-ua-webview

    Javascript:

    var isWebview = require('is-ua-webview');    
    var some_variable = isWebview(navigator.userAgent);
    

    Angular2+:

    import * as isWebview from 'is-ua-webview';
    const some_variable = isWebview(navigator.userAgent);
    

提交回复
热议问题