How will I be able to get the version number of my application in metro javascript?
For example, this is the 1.2 version of our application, how can I get the version number in my javascript metro code?
How will I be able to get the version number of my application in metro javascript?
For example, this is the 1.2 version of our application, how can I get the version number in my javascript metro code?
You can use the Windows.ApplicationModel.Package.current.id.version object to reference the version specified in your application manifest.
The version object contains "build, major, minor & revision" properties.
For further details, see http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.package.aspx
Use this helper method to get the version as a complete string:
function getAppVersion() {
var p = Windows.ApplicationModel.Package.current.id.version;
return p.major + "." + p.minor + "." + p.build + "." + p.revision;
}
To display it to the user:
document.getElementById("version").innerHTML = "version " + getAppVersion();
This assumes you add this tag:
<span id="version"></span>
You can use the Windows.ApplicationModel.Package.current.id.version object to reference the version specified in your application manifest.
The version object contains "build, major, minor & revision" properties.
For further details, see http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.package.aspx
How about this;
function getCurrentApplicationVersion() {
var currentVersion = Windows.ApplicationModel.Package.current.id.version;
var values = [];
for (var key in currentVersion) {
values.push(currentVersion[key]);
}
return values.join('.');
}
© 2022 - 2024 — McMap. All rights reserved.