I found a partly functioning version of this code on StackOverflow, and then added some object tests for IE to get around this issue.
<!DOCTYPE html>
<HTML>
<HEAD>
<META http-equiv="X-UA-Compatible" content="IE=edge">
</HEAD>
<BODY></BODY>
<SCRIPT type="text/javascript">
function get_browser_info(){
var ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem=/\brv[ :]+(\d+)/g.exec(ua) || [];
return {name:'Internet Explorer',version:(tem[1]||'')};
}
if(M[1]==='Chrome'){
tem=ua.match(/\bOPR\/(\d+)/)
if(tem!=null) {return {name:'Opera', version:tem[1]};}
}
M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem=ua.match(/version\/(\d+)/i))!=null) {M.splice(1,1,tem[1]);}
var ret = {
name: M[0],
version: M[1]
};
if(ret.name==="MSIE"&&ret.version==="7")
{
ret.name = "Internet Explorer";
if(typeof navigator.maxTouchPoints !="undefined") ret.version = "11";
else if(document.all && window.matchMedia) ret.version = "10";
else if(XDomainRequest && window.msPerformance) ret.version = "9";
else if(XDomainRequest) ret.version = "8";
else if(document.documentElement && typeof document.documentElement.style.maxHeight!="undefined") ret.version = "7";
else if(document.compatMode && document.all) ret.version = "6"; //uhh?
else if(window.createPopup) ret.version = "5.5";
else if(document.all) ret.version = "4";
}
return ret;
}
window.onload = function() {
var browser = get_browser_info()
window.location = "byond://winset?command=setBrowser " + encodeURIComponent(browser.name) + " " + encodeURIComponent(browser.version);
}
</SCRIPT>
</HTML>
Then, all you need to do is just set up the verb on the client:
client
var
browser
browser_version
verb
setBrowser(Browser as text,Version as num)
set hidden = 1
browser = Browser
browser_version = Version
New()
src << browse('version test.html',"window=hiddenbrowser;")
..()
Make certain you put a hidden browser in your interface somewhere named "hiddenbrowser".
Had me going lol