|
device.name 设备名称 device.platform 设备平台 device.uuid uuid编码 device.version 平台版本
PhoneGap获取设备信息源码教程- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="utf-8">
- <title>PhoneGap-Device</title>
- <link rel="stylesheet" href="../jquery.mobile-1.1.1/jquery.mobile-1.1.1.css" />
- <script src="../jquery.mobile-1.1.1/jquery.js"></script>
- <script src="../jquery.mobile-1.1.1/jquery.mobile-1.1.1.js"></script>
- <script type="text/javascript" charset="utf-8" src="../cordova-1.9.0.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- document.addEventListener("deviceready", myDeviceReadyListener, false); //设备加载完成回调函数
- });
-
- function myDeviceReadyListener(){
- console.log("设备加载完毕!");
- $("#deviceName .ui-btn-text").text("设备名称" + device.name);
- $("#deviceCordova .ui-btn-text").text("PhoneGap版本" + device.cordova);
- $("#devicePlatform .ui-btn-text").text("设备平台" + device.platform);
- $("#deviceUUID .ui-btn-text").text("uuid编码" + device.uuid);
- $("#deviceVersion .ui-btn-text").text("平台版本" + device.version);
- }
-
- </script>
- </head>
- <body>
- <div data-role="page">
- <div data-role="header">
- <h1>PhoneGap实战</h1>
- </div>
- <div data-role="content">
- <a href="#" data-role="button" id="deviceName"></a>
- <a href="#" data-role="button" id="deviceCordova"></a>
- <a href="#" data-role="button" id="devicePlatform"></a>
- <a href="#" data-role="button" id="deviceUUID"></a>
- <a href="#" data-role="button" id="deviceVersion"></a>
- </div>
- <div data-role="footer">
- <h4> </h4>
- </div>
- </div>
- </body>
- </html>
复制代码 |
|