You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

detectDevices.js 474B

1234567891011121314151617181920212223
  1. /**
  2. * Returns true if user agent is run on Android.
  3. *
  4. * @returns {boolean}
  5. */
  6. export function detectAndroid() {
  7. return Boolean(navigator.userAgent.match(/Android/i));
  8. }
  9. /**
  10. * Returns true if user agent is run on iOS.
  11. *
  12. * @returns {boolean}
  13. */
  14. export function detectIOS() {
  15. if (navigator.userAgent.match(/iPhone/i)
  16. || navigator.userAgent.match(/iPad/i)
  17. || navigator.userAgent.match(/iPod/i)) {
  18. return true;
  19. }
  20. return false;
  21. }