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

How to use phonegap to obtain device information

巴扎黑
Release: 2017-08-08 16:41:16
Original
1298 people have browsed it

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>
Copy after login

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!