|
这个方法针对单个页面是可以,如果有下级页面的话,就比较麻烦一些,我分别抓了一下快应用和UC浏览器中的userAgent,可以通过package(应用包名)‘com.test.demo’来区分是否是快应用环境。
Mozilla/5.0 (Linux; Android 9; PCT-AL10 Build/HUAWEIPCT-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/70.0.3538.110 Mobile Safari/537.36 hap/1.4/huawei org.hapjs.mockup/1.4.0.0 com.test.demo/1.0.0 ({"packageName":"org.hapjs.mockup","type":"other","extra":{}})
Mozilla/5.0 (Linux; U; Android 9; zh-CN; PCT-AL10 Build/HUAWEIPCT-AL10) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.3.6.1016 Mobile Safari/537.36 |
|