[英]Meteor: How to detect device model & OS version?
An almost trivial answer without any Cordova plugins or Meteor packages: 几乎没有任何Cordova插件或Meteor软件包的简单答案:
var device_info = window.navigator.userAgent;
var display_size = screen.width + 'x' + screen.height;
device_info looks something like "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/50.0.2661.86 Mobile Safari/537.36", device_info看起来类似于“ Mozilla / 5.0(Linux; Android 5.1.1; Nexus 5 Build / LMY48M; wv)AppleWebKit / 537.36(KHTML,如Gecko)版本/4.0 Chrome / 50.0.2661.86 Mobile Safari / 537.36”,
Quick and dirty, but all the information is in there and there are no Cordova native plugins to go wrong. 快速又肮脏,但是所有信息都在那里,并且没有Cordova本机插件出错。
I think you're looking for this plugin: https://www.npmjs.com/package/cordova-plugin-device 我认为您正在寻找此插件: https : //www.npmjs.com/package/cordova-plugin-device
/////// EDIT ////////////// ///////编辑///////////////
Well, I don't use meteor, but I can drop you a jquery sniplet: 好吧,我不使用流星,但是我可以给你一个jQuery片段:
jQuery(document).ready(function($) {
$(document).on('deviceready', function() {
$('#device-platform').html(device.platform);
$('#device-version').html(device.version);
$('#device-cordova').html(device.cordova);
$('#device-model').html(device.model);
$('#device-uuid').html(device.uuid);
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.