I would like to detect when user is working with Metro vs Desktop IE10.
I've searched the web quite a lot and conclusion i've found is that there is no 100% way to find out (using code) if user is running in IE10 Metro style or Desktop style. Then i've found some site, which has a avascript detecting activeX.
will this be enough for detecting Metro vs Desktop?
The code is the following:
<html>
<body>
<script type="text/javascript">
var myActiveX = null;
var isActiveXCapable = false;
function InitMyActiveX() {
try {
new ActiveXObject("");
}
catch (e) {
// FF has ReferenceError here
if (e.name == 'TypeError' || e.name == 'Error') {
isActiveXCapable = true;
}
}
try {
myActiveX = new ActiveXObject("My.ActiveX");
}
catch (e) {
myActiveX = null;
}
if (myActiveX != null) {
document.getElementById("myInfo").innerHTML = myActiveX.GetSomeInfo();
} else {
document.getElementById("CallMyActiveX").setAttribute("disabled", "disabled");
if (!isActiveXCapable) {
document.getElementById("myInfo").innerHTML = "Browser does not support ActiveX";
} else {
document.getElementById("myInfo").innerHTML = "MyActiveX is not installed";
}
}
}
function DoSomething() {
InitMyActiveX();
if (myActiveX != null) {
var s = myActiveX.DoSomething();
document.getElementById("myResult").innerHTML = s;
}
}
</script>
<div id="myInfo"></div>
<input type="button" id="CallMyActiveX" value="Call me" onclick="DoSomething()" />
<div id="myResult"></div>
</body>
</html>
When executing simply on IE10 desktop i see "MyActiveX is not installed". In firefox i get: "MyActiveX is not installed". Will i get the same result in IE10 Metro style? will this assist finding out if running in metro?
In case this is not correct and there is no way to differentiate between them, then How do i totally imitate the Metro style in IE10 desktop? how do i totaly disable activeX so it will give me same result as metro Ie10?
Thanks, Tal