How to Get UDID With JavaScript
It's possible to retrieve the Unique Device Identifier (UDID) of an iOS device, such as the iPhone, with JavaScript and later use it in your application. UDID is a serial number specific to Apple iOS devices. JavaScript is a browser-based programming language rather than a server side language that relies on a server to process the code and information. As long the phone's browser has JavaScript enabled, you should be able to get the UDID without a problem.
Instructions
-
-
1
Launch a HTML or text editor and open the HTML document you wish to edit. You'll be adding a new function to an already existing file.
-
2
Add the following lines of code inside the HTML file where you have created other JavaScript functions:
-
-
3
Insert the following lines of code into your document:
UIDevice *aDevice = [UIDevice currentDevice];
NSMutableArray *passingArray = [[NSMutableArray alloc] initWithCapacity:5];
[passingArray addObject: [aDevice uniqueIdentifier]]; -
4
Insert the following function code below the previous lines:
function displayDeviceInfoVCF(data, paramArray){
document.getElementById(‘devDisplay’).innerText = ‘UDID;
} -
5
Call the function anywhere you want in your HTML document by adding this line of code:
document.write(displayDeviceInfoVCF());
-
6
Save the HTML file, then upload and publish the file to the Web via your hosting server.
-
1
References
Resources
- Photo Credit Oli Scarff/Getty Images News/Getty Images