Set Up
Initalize Project
Run the following command in your terminal to setup a basic node.js project (skip if you've already done this):
npm init
npm will then ask you a few questions, and then create a package.json
file for you. Once this is done, move on to the next step.
Download
Downloading the package can be done in one command.
npm i -d uadetect
This will add the package to your project, and then install all of the dependencies. To verify that the process has completed, check your package.json
file.
Project Structure
In your index.html
file, add the following code to your <head>
section:
<script type="module" src="src/uadetect.js"></script>
Then, create a src
directory, and add the following code to your src/uadetect.js
file:
import { } from 'uadetect';
NOTE:
It's important that you leave the { }
in the import statement, as it will be used later on to selectively import the components you need.
Next Section
Table of Contents