Polat Dundar
Polat Dundar

Reputation: 76

How Can I Get Device Id

I use Jquery mobile instead of cordova. How can I get device id by uisng Jquery or pure javascript?

I found some solutions but all of them are about cordova. I dont want to use cordova.

edit: I mean unique id. User will login, and close the application (not logout) then open again. The application have to know which user come to. Mobile devicec dont have cockie or session.

Upvotes: 0

Views: 1235

Answers (1)

Der Vampyr
Der Vampyr

Reputation: 951

What do you mean by device id? If you want to know which device is used you can check it like this:

if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
  isMobileDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|webOS)/);
}

if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
  isIpad = navigator.userAgent.match(/(iPad)/);
}

Upvotes: 1

Related Questions