Identify Devices in Angular 5 [closed]

0

How can I know which device was connected to my angular application? I would like to identify it to be able to make only devices ios can connect.

    
asked by Christopher Flores 18.03.2018 в 20:36
source

1 answer

1

Since you are doing your application in Angular5 I recommend this plugin: link

Demo: link

The other option is to use simple javascript.

Using navigator.userAgent you can get the device, browser and other information:

link

$(document).ready(function(){
    var ua = navigator.userAgent;
		console.log(ua);
    if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i.test(ua))
    {
       console.log('iOs');
    }
    else if(/Chrome/i.test(ua))
    {
       console.log('Chrome');
    }
    else
    {
      console.log('Desktop');
    }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    
answered by 18.03.2018 / 21:40
source