Wireless Access

Reply
Occasional Contributor II

repost of the useful code snippet for client autodetection through web browser

Hi all,

 

it seems that the import of all the airheads data into the new forum nerfed the code snippet that I posted to help detect client versions for the VIA welcome.html page (including detecting Windows 64 bit OS running a 32 bit browser). This assumes that you have already uploaded VIA clients into your controller for Win32, Win64 and MacOS.

 

 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>Welcome VIA user</title>
<script>
<!--
function init() {
var clientVersion = navigator.platform;
var osVersion = null;
if (navigator.userAgent.indexOf("Windows NT 5.1")!=-1) {
osVersion = "Windows XP";
} else if (navigator.userAgent.indexOf("Windows NT 6.0")!=-1) {
osVersion = "Windows Vista";
} else if (navigator.userAgent.indexOf("Windows NT 6.1")!=-1) {
osVersion = "Windows 7";
} else if (navigator.userAgent.indexOf("Macintosh")!=-1) {
osVersion = "Mac OS";
}
var msg = "We have made our best guess at detecting your operating " +
"system and have determined it to be: " + osVersion;
var dw_msg = "If this is correct, download your VIA client here:";
var admin_msg = null;
var os = null;
if (clientVersion == "Win64" || navigator.userAgent.indexOf('WOW64')) {
msg += " 64 bit";
os = "win64";
} else if (clientVersion == "Win32") {
msg += " 32 bit";
os = "win32";
} else if (clientVersion == "MacIntel") {
os = "osx";
} else {
msg = "Currently we do are not supproting: " + clientVersion;
admin_msg = "Please check with your system administrator to see if a version of VIA is available for your operating system.";
dw_msg = null;
}
document.getElementById('msg').innerHTML = msg;
if (dw_msg) document.getElementById('dw_msg').innerHTML = dw_msg;
if (admin_msg)
document.getElementById('admin_msg').innerHTML = admin_msg;
else
document.getElementById('admin_msg').style.display = 'none';
var download = '';
var other    = '';
if (os)
download = '<a href="/via/download?os=' + os + '">VIA Installer ('+ clientVersion + ')</a>'
document.getElementById('download').innerHTML = download;
document.getElementById('other').innerHTML = other;
}
</script>
</head>
<body onload="init()">
Welcome VIA user <b><% user %></b>@<% ip %>/<% role %>
<p id="msg" style="color:#B30004;font-size:18px;font-weight:bold;"></p>
<p id="admin_msg" style="color:#0011AA;font-size:15px;font-weight:bold;"></p>
<div style="margin-bottom:20px;">
<span id="dw_msg" style="font-size:15px;font-weight:bold;margin-right:10px;"></span>
<div id="download"></div>
</div>
<input type="button" name="Logout" value="Logout"  onclick="javascript&colon;location.href='<% logout %>'"
</body>
</html>

 

Guru Elite

Re: repost of the useful code snippet for client autodetection through web browser

Ian,

Thank you. This will be useful for users that cannot update to 6.1.2.4 immediately.


Colin Joseph
Aruba Customer Engineering

Looking for an Answer? Search the Community Knowledge Base Here: Community Knowledge Base

Contributor I

Re: repost of the useful code snippet for client autodetection through web browser

I've tested this on a couple of OS and it's not completely working i think:

- MacOSX is fine

- Windows XP 32 bit with IE/FF detects as Windows XP 64 bit

- Windows 7 64 bit with IE/FF detects as 64-bit but the download text shows:

VIA installer (32bit)

 

I'm running 6.1.2.5 code - auto detection is still a problem with 64 bit hosts being detected as 32 bit, that's why I'm looking into a solution.

Guru Elite

Re: repost of the useful code snippet for client autodetection through web browser

Theymans,

 

On 6.1.2.5, which 64 bit hosts did you use, and what browser?  In addition, what result did you get?

 

 



Colin Joseph
Aruba Customer Engineering

Looking for an Answer? Search the Community Knowledge Base Here: Community Knowledge Base

Contributor I

Re: repost of the useful code snippet for client autodetection through web browser

I've tested with Windows 7 SP1 64 bit IE 9, result:

 

We have made our best guess at detecting your operating system and have determined it to be: Windows 7 32 bit
If this is correct, download your VIA client here:
VIA Installer (Win32)

 

However when I test it with the IE 9 64 bit version, it's OK and gives me Windows 7 64 bit.

 

But in my opinion it should detect the OS architecture, not the browser which could be 32 or 64 bit on a 64 bit OS.

Guru Elite

Re: repost of the useful code snippet for client autodetection through web browser

theymans,

 

It is difficult to reliably detect a 64-bit OS in a 32-bit browser, is the issue.

 

 

http://stackoverflow.com/questions/1741933/detect-64-bit-or-32-bit-windows-from-user-agent-or-javascript

 



Colin Joseph
Aruba Customer Engineering

Looking for an Answer? Search the Community Knowledge Base Here: Community Knowledge Base

Moderator

Re: repost of the useful code snippet for client autodetection through web browser

theymans, there is a small typo in the script, the following:

 

if (clientVersion == "Win64" || navigator.userAgent.indexOf('WOW64')) {
msg += " 64 bit";
os = "win64";

 

should be changed as follows, i think this may be responsible for some of the false hits on win64 being reported here

 

if (clientVersion == "Win64" || navigator.userAgent.indexOf('WOW64') != -1) {
msg += " 64 bit";
os = "win64

 

 

 

Occasional Contributor II

Re: repost of the useful code snippet for client autodetection through web browser

thanks for the correction there Jeff... the original snippet that we created was missing that too!

Contributor I

Re: repost of the useful code snippet for client autodetection through web browser

is this snippet to be loaded onto the controller that supports VIA? Does the snippet need the modification for the 64 bit? I have users running 64 bit machines with 32 bit browsers and they can't download 64 bit version. Just looking for clarification as to how to make this work.

 

Thanks

Occasional Contributor II

Re: repost of the useful code snippet for client autodetection through web browser

the code segment (including spelling errors!) can be loaded into the welcome.html page on the controller that is presenting the VIA download (generally https://<IP.OF.MOBILITY.CONTROLLER>/via/welcome.html to provide an autodetection capability to present clients with the correct version of VIA to download. This assumes that you already have loaded in the VIA clients into the controller as well, otherwise clients won't get a valid link.

 

I've just checked one of my controllers running an ArubaOS 6.1.3 variant and this feature is in there already, so you shouldn't have to add it in (and it avoids a couple of my spelling mistakes!). I can't remember exactly when this was introduced into the firmware so you may already have it; just download the page from the controller and have a look.

Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: