157 lines
5.6 KiB
HTML
157 lines
5.6 KiB
HTML
<% /*
|
|
$Revision$
|
|
$Id$
|
|
*/
|
|
// File: shared/useragent.inc
|
|
// Used by: Facilitor.asp
|
|
// Status: Ready
|
|
//
|
|
// Determines the version of the user agent (the browser version)
|
|
// and selects the right mode or requests user to upgrade
|
|
//
|
|
// Sets globals isHandheld, isTouchscreen
|
|
// returns false if undetermined/ not supported
|
|
//
|
|
// isHandheld leidt in principe naar de versimpelde mobile schermen, te forceren met &pda=1 MITS je mobile_enabled hebt
|
|
// anders: isTouchscreen leidt naar de gewone Facilitor schermen maar zonder Frame eromheen, te forceren met &touch=1
|
|
// anders: de gewone desktop interface, te forceren met &desktop=1
|
|
//
|
|
// Soms sample agentstrings (from IIS logfile)
|
|
// iPhone: Mozilla/5.0+(iPod;+U;+CPU+iPhone+OS+2_2_1+like+Mac+OS+X;+nl-nl)+AppleWebKit/525.18.1+(KHTML,+like+Gecko)+Version/3.1.1+Mobile/5H11a+Safari/525.20
|
|
// iPad: Mozilla/5.0 (iPad;+U;+CPU+OS+4_3_1+like+Mac+OS+X;+nl-nl) etc
|
|
// Phone : Nokia6230i/2.0+(03.80)+Profile/MIDP-2.0+Configuration/CLDC-1.1
|
|
// Mozilla/5.0+(SymbianOS/9.2;+U;+Series60/3.1+NokiaE63-1/200.21.012;+Profile/MIDP-2.0+Configuration/CLDC-1.1+)+AppleWebKit/413+(KHTML,+like+Gecko)+Safari/413
|
|
// Mozilla/5.0+(SymbianOS/9.3;+Series60/3.2+NokiaE72-1/051.018;+Profile/MIDP-2.1+Configuration/CLDC-1.1+)+AppleWebKit/525+(KHTML,+like+Gecko)+Version/3.0+BrowserNG/7.2.6.2+3gpp-gba
|
|
// Opera/9.80+(S60;+SymbOS;+Opera+Mobi/498;+U;+nl)+Presto/2.4.18+Version/10.00
|
|
// PDA : Mozilla/4.0+(compatible;+MSIE+4.01;+Windows+CE;+PPC;+240x320)
|
|
// Galaxy Tab: Mozilla/5.0 (Linux; U; Android 2.2; en-us; SCH-I800 Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
|
|
// W8phone : Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)
|
|
// W7.5phone: Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; SAMSUNG; SGH-i917)
|
|
//
|
|
// -IE6 : Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727)
|
|
//
|
|
|
|
function checkUserAgent ()
|
|
{
|
|
var res = _checkUserAgent ();
|
|
device.set(device.isSupported, res.isSupported);
|
|
device.set(device.supportsPlaceholder, res.supportsPlaceholder);
|
|
if (res.isHandheld)
|
|
{
|
|
device.set(device.isMobile, 1);
|
|
device.set(device.isDesktop | device.isTouch, 0);
|
|
}
|
|
else if (res.isTouchscreen)
|
|
{
|
|
device.set(device.isTouch, 1);
|
|
device.set(device.isDesktop | device.isMobile, 0);
|
|
}
|
|
else
|
|
{
|
|
device.set(device.isDesktop, 1);
|
|
device.set(device.isTouch | device.isMobile, 0);
|
|
}
|
|
|
|
if (device.test(device.isDesktop))
|
|
device.set(device.canPrint | device.canExcel, 1);
|
|
else if (device.test(device.isTouch))
|
|
{
|
|
device.set(device.canPrint, 1);
|
|
device.set(device.canExcel, 0);
|
|
}
|
|
else
|
|
device.set(device.canPrint | device.canExcel, 0);
|
|
|
|
return res.isSupported;
|
|
}
|
|
|
|
function _checkUserAgent ()
|
|
{
|
|
// Anno 5.3.1: alles is supported behalve IE6 en lager
|
|
var res = { isSupported: true,
|
|
isTouchscreen: false,
|
|
isHandheld: false,
|
|
supportsPlaceholder: true
|
|
};
|
|
// Mogelijkheid iets expliciet *aan* te zetten
|
|
if (getQParamInt("mobile",0)==1 || getQParamInt("pda",0)==1)
|
|
{
|
|
res.isHandheld = S("mobile_enabled")==1;
|
|
return res;
|
|
}
|
|
else if (getQParamInt("touch",0)==1)
|
|
{
|
|
res.isTouchscreen = true;
|
|
return res;
|
|
}
|
|
else if (getQParamInt("desktop",0)==1)
|
|
{
|
|
// geen autodetect doen. isHandheld en isTouchscreen blijven false.
|
|
return res;
|
|
}
|
|
|
|
// dan maar eerst autodetect
|
|
|
|
var ver;
|
|
var agent = "" + Request.ServerVariables("HTTP_USER_AGENT");
|
|
|
|
// Try to find out with some certainty that is is a mobile device
|
|
var acknowledgedmobiledevice = agent.indexOf("MIDP") != -1
|
|
|| agent.indexOf("CLDC") != -1
|
|
|| agent.indexOf("SymbOS") != -1
|
|
|| agent.indexOf("Opera Mini") != -1
|
|
|| agent.indexOf("SymbianOS") != -1
|
|
|| agent.indexOf("BlackBerry") != -1
|
|
|| agent.indexOf("iPhone") != -1
|
|
|| agent.indexOf("Android") != -1
|
|
|| agent.indexOf("IEMobile") != -1;
|
|
|
|
res.isTouchscreen = agent.indexOf("iPad") != -1
|
|
|| (agent.indexOf("Android") != -1) && (agent.indexOf("Mobile") == -1)
|
|
|| agent.indexOf("SCH-I800") != -1;
|
|
|
|
if (acknowledgedmobiledevice)
|
|
{
|
|
if (S("mobile_enabled")==1)
|
|
res.isHandheld = true;
|
|
else
|
|
res.isTouchscreen = true; // Fallback als geen mobile licentie
|
|
}
|
|
else // Perhaps an IE version.
|
|
{
|
|
var i = agent.indexOf("MSIE");
|
|
if (i >= 0)
|
|
{
|
|
// This is an IE browser
|
|
var ver = parseFloat(agent.substr(i+4));
|
|
|
|
if (ver < 7)
|
|
{
|
|
res.isSupported = false;
|
|
i = agent.indexOf("Windows CE");
|
|
if (i != -1) {
|
|
res.isHandheld = S("mobile_enabled")==1;
|
|
res.isSupported = true;
|
|
}
|
|
}
|
|
if (ver <= 9)
|
|
{
|
|
res.supportsPlaceholder = false;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
// Nu nog de mogelijkheid iets expliciet *uit* te zetten
|
|
if (getQParamInt("mobile",-1)==0 || getQParamInt("pda",-1)==0)
|
|
{
|
|
res.isHandheld = false;
|
|
}
|
|
if (getQParamInt("touch",-1)==0)
|
|
{
|
|
res.isTouchscreen = false;
|
|
}
|
|
|
|
return res;
|
|
}
|
|
%> |