有些时候,我们在开发过程中需要判断,当前页面被打开是否是处于源生的webview里面,或者NODEJS做服务器后端支持的时候,判断请求来源是否来至于源生webview里面被打开的页面请求GET/POST/..
于是写了一个轮子,用javascript的形式判断当前设备android或者ios,是不是又webview来装载页面内容 还是 浏览器(非webview)来装载页面内容。
js-is-webview
github:https://github.com/wuliqiangqiang/is-webview
use javascrupt to know it is webview ?
support node and the browser(webpack)
pass User-Agent sniffing,know the HTTP/HTTPS request is performed by a UIWebview/Webview or not.
安装
npm install js-is-webview --save
Node 服务端的用法
const isWebview = require("js-is-webview");
const is_webview = new isWebview