Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation question regarding "warning" #99

Open
LukeLeber opened this issue Nov 25, 2019 · 1 comment
Open

Documentation question regarding "warning" #99

LukeLeber opened this issue Nov 25, 2019 · 1 comment

Comments

@LukeLeber
Copy link

Quoting the warning from the documentation:

TL;DR: you should not use this library in your HTML page and it's less reliable when used server-side (Node.js)

What exactly does this mean? Should this project not be used anymore, or is there additional context around exactly what it should not be used for?

Our use case if determining the device class, such as...

console.log( md.mobile() );          // 'Sony'
console.log( md.phone() );           // 'Sony'
console.log( md.tablet() );          // null

Is this library still reliable enough to produce consistent results for this use case?

Thanks.

@hgoebl
Copy link
Owner

hgoebl commented Nov 26, 2019

It depends on what you want to achieve.

  • The Regular Expressions are always behind devices in the wild and not all devices are covered, even old ones
  • There are problems with newer iPads prepending they are desktop
  • There are problems with Windows devices prepending they are Android and iOS devices
  • Loading the library in the browser produces a lot of traffic and delays rendering
  • Using the library on server-side lacks access to viewport dimensions, touch capability, ...
  • The library depends on another library which produces further lags until being up-to-date

=> depending on your use-case, live with the shortcomings or (better) find another solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants