これがないドキュメントの最新バージョンです!
Click here for the latest released version.
device.platform
デバイスのオペレーティング システム名を取得します。
var string = device.platform;
サポートされているプラットフォーム
- アンドロイド
- ブラックベリー WebWorks (OS 5.0 およびより高い)
- iOS
- Tizen
- Windows Phone 7 と 8
- Windows 8
簡単な例
// Depending on the device, a few examples are:
// - "Android"
// - "BlackBerry"
// - "iOS"
// - "WinCE"
// - "Tizen"
var devicePlatform = device.platform;
完全な例
<!DOCTYPE html>
<html>
<head>
<title>Device Properties Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
//
function onDeviceReady() {
var element = document.getElementById('deviceProperties');
element.innerHTML = 'Device Model: ' + device.model + '<br />' +
'Device Cordova: ' + device.cordova + '<br />' +
'Device Platform: ' + device.platform + '<br />' +
'Device UUID: ' + device.uuid + '<br />' +
'Device Version: ' + device.version + '<br />';
}
</script>
</head>
<body>
<p id="deviceProperties">Loading device properties...</p>
</body>
</html>
ブラックベリーの癖
デバイスは、プラットフォーム名ではなくデバイス プラットフォームのバージョン番号を返すことがあります。たとえば、Storm2 9550 を返しますよう2.13.0.95
.
Windows Phone 7 の癖
Windows Phone 7 デバイスとプラットフォームを報告します。WinCE
.
Windows Phone 8 癖
Windows Phone 8 デバイスとプラットフォームを報告します。Win32NT
.