Skip to content

Groschenroman/device-type-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Device Type Detection

JavaScript Snippet to detect the device type a user is browsing with. The Script is inspired by detectmobilebrowsers.com. Thanks Chad Smith for this great site.

Installation

1. Import file

Copy the deviceTypeDetection.js file into your website project.

2. Embed file

Place the script tag in the <head> section of your site like this: <script src="path/to/deviceTypeDetection.js"></script> NOTE: To use the script you have to place this script tag before your custom javascript. Example:

  <head>
    ...
    <script type="text/javascript" src="path/to/deviceTypeDetection.js"></script>
    <script type="text/javascript">
      YOUR JAVASCRIPT GOES HERE
    </script>
  </head>

Usage

In your custom JavaScript run getDeviceType();

Returns

The function returns one of the following strings:

"mobile"
"tablet"
"desktop"

About

JavaScript Snippet to detect user device types.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published