Home  >  Article  >  Web Front-end  >  Detailed example of obtaining device information through phonegap

Detailed example of obtaining device information through phonegap

Y2J
Y2JOriginal
2017-05-20 13:31:041216browse

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(&#39;props&#39;);   
                myp.innerHTML = &#39;Device Name: &#39; + device.name + &#39;<br />&#39; +   
                    &#39;Device PhoneGap: &#39; + device.phonegap + &#39;<br />&#39; +   
                    &#39;Device Platform: &#39; + device.platform + &#39;<br />&#39; +   
                    &#39;Device UUID: &#39; + device.uuid + &#39;<br />&#39; +   
                    &#39;Device Version: &#39; + device.version + &#39;<br />&#39;  
    
            }   
        </script>   
    </head>   
    
    <body onload="onLoad()">   
        <p id="props"> Loading device properties...</p>   
    </body>   
    
</html>

[Related recommendations]

Html5 free video tutorial

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

Statement:
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