Home > Article > Web Front-end > How to use phonegap to obtain device information
The following editor will bring you some methods of using phonegap to obtain device information. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor to take a look.
device.name The name of the device
device.phonegap phonegap version
device.platform Type of device
##device.uuid Device unique identification number
device.version Version of the operating system running
device is assigned to the window object
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>My Device</title> <script type="text/javascript" charset="UTF-8" src="cordova.js"></script> <script type="text/javascript" charset="UTF-8"> function onLoad() { document.addEventListener("deviceready", onDeviceReady, false); } function onDeviceReady() { var myp = document.getElementById('props'); myp.innerHTML = 'Device Name: ' + device.name + '<br />' + 'Device PhoneGap: ' + device.phonegap + '<br />' + 'Device Platform: ' + device.platform + '<br />' + 'Device UUID: ' + device.uuid + '<br />' + 'Device Version: ' + device.version + '<br />' } </script> </head> <body onload="onLoad()"> <p id="props"> Loading device properties...</p> </body> </html>
The above is the detailed content of How to use phonegap to obtain device information. For more information, please follow other related articles on the PHP Chinese website!