bowser-js / bowser

a browser detector
Other
5.52k stars 487 forks source link

传统方式的项目如何使用此插件?(How to use this plug-in for traditional projects?) #491

Closed WangJincheng4869 closed 2 years ago

WangJincheng4869 commented 3 years ago

我目前的项目只是使用jQuery,将需要的js文件引入HTML中进行使用。项目未使用webpack。请问将如何使用? 我曾尝试引入bundled.jses5.js无法正常使用,找不到Bowser对象。(我的英文不好,只能使用Google翻译)

My current project just uses jQuery, and introduces the required js files into HTML for use. The project does not use webpack. How will it be used? I have tried to import bundled.js or es5.js which cannot be used normally, and the Bowser object cannot be found. (My English is not good, I can only use Google Translate)

hellohejinyu commented 2 years ago

image es5.js 亲测可以。

WangJincheng4869 commented 2 years ago

image es5.js 亲测可以。

感谢,原来如此,不能直接使用bowser.getParser()必须要写bowser.getParser(window.navigator.userAgent)