Home  >  Article  >  Web Front-end  >  How to use phonegap to obtain device information

How to use phonegap to obtain device information

巴扎黑
巴扎黑Original
2017-08-08 16:41:161325browse

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>

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!

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