Here's a function that I built based on this blog. Basically, the only thing I've improved upon is the option to return either the version or the year.
But you can do this from a web-page without any admin access at all.
//Returns 12, 14, 16 respectively, or 0 if no version is found (which means it isn't sharepoint)
//see http://techtrainingnotes.blogspot.com/2010/12/sharepoint-how-to-get-sharepoint.html
function GetSharepointVersion(asYear){
if(!thisPageIsSharepoint){ return "";}
//method one
//var SPversion = (typeof unsafeWindow._fV4UI == "undefined") ? "12" : "14";
//var SPversion = (typeof _fV4UI == "undefined") ? "12" : "14";
var SPVersion = "";
var xmlHttp = null;
if (XMLHttpRequest) {
xmlHttp = new XMLHttpRequest(); // If IE7, Mozilla, Safari, and so on: Use native object.
}else{
if (ActiveXObject) {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0'); // ...otherwise, use the ActiveX control for IE5.x and IE6.
}
}
xmlHttp.open('HEAD', unsafeWindow.location.href, false);
xmlHttp.send();
SPVersion = xmlHttp.getResponseHeader("MicrosoftSharePointTeamServices");
if(SPVersion == null || SPVersion == undefined){ return ""; }
if(asYear){
switch(SPVersion.substring(0,2) ){
case "16": return "O365"; break;
case "15": return "2013"; break;
case "14": return "2010"; break;
case "13": return "2007"; break;
case "11": return "2003"; break;
case "10": return "2001"; break;
default: return ""; break;
}
}else{
return SPVersion; //else return the entire version number
}
}