Getting (mobile) device name from javascript
You can't do this through javascript for a web app running in a native browser - javascript generally doesn't have access to this personal identifying data.
One possible way is to use a framework like PhoneGap which may have an API to access the device name. But then, you can only deploy your web site via an app store, so this could be very limiting based on your use case.
Your best bet is to use the user agent:
e.g.
const ua = navigator.userAgent
const device = {
iPad: /iPad/.test(ua),
iPhone: /iPhone/.test(ua),
Android4: /Android 4/.test(ua)
}
The object will allow you to write nice conditional logic such as if(device.iPad) { /* do stuff */ }