Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
javascript
javascript

var useragent = navigator.userAgent;
if (useragent.match(/Android/i)) {
  // This is an Android device
}
Using RPG Code:
Code Block

D getenv          PR              *   ExtProc('getenv')
D   name                          *   Value Options(*String)

D useragent       s            250A

 /Free
       useragent = %str(getenv('HTTP_USER_AGENT'));
       If %scan('Android' : useragent) > 0;
         // This is an Android device
       EndIf;
 /End-Free
Using PHP Code:
Code Block

$useragent = $_SERVER['HTTP_USER_AGENT'];
if (stripos($useragent, 'Android') !== false) {
  // This is an Android device
}

...