Home > Web Front-end > H5 Tutorial > body text

Detailed explanation of phonegap's method of obtaining device information

php中世界最好的语言
Release: 2018-03-26 15:35:33
Original
1693 people have browsed it

This time I will bring you a detailed explanation of the method of obtaining device information with phonegap. What are the precautions for obtaining device information with phonegap? The following is a practical case, let’s take a look.

device.name The name of the device

device.phonegap phonegap version

device.platform Device type

device.uuid Device unique identification number

device.version The version of the operating system that is 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>
Copy after login
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Detailed explanation of phonegap operation database

Detailed explanation of phonegap creation of contacts

The above is the detailed content of Detailed explanation of phonegap's method of obtaining device information. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template