js-is-webview
use javascrupt to know it is webview ? support node and the browser(webpack)
install
npm install js-is-webview --save
usage in node
pass User-Agent sniffing,know the HTTP/HTTPS request is performed by a UIWebview/Webview or not.
const isWebview = ;const is_webview = ; const server = { - let userAgent = - userAgent:reqheaders'User-Agent' // if true ifisWebview) //... ; };
usage in the browser
pass the browser features and properties,know it is webview or
const isWebview = ;const is_webview = ; let userAgent = userAgent:navigatoruserAgent ifisWebview) //...
API
iswebview.check({userAgent})
userAgent
(Object.key): Browser User-Agent header string
ifisWebview) //...
iswebview.check({userAgent, configObject})
userAgent
(Object.key): Browser User-Agent header stringconfigObject
(Object)appName
(String): the app name explicitly set in your WebView properties/settings.