From 51804c80dd6290db34438ad7924ff0d968c9378f Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 27 Mar 2013 05:37:30 +0000 Subject: [PATCH] allow forcing of mobile/desktop site with vp=m or vp=f URL parameters this will allow the IITC Mobile app to include an option to choose desktop/mobile versions of IITC for regular desktop browsers, don't expect it to work well with vp=m --- code/smartphone.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/smartphone.js b/code/smartphone.js index 37c89a4a..8cd4ad02 100644 --- a/code/smartphone.js +++ b/code/smartphone.js @@ -2,6 +2,15 @@ window.isSmartphone = function() { // this check is also used in main.js. Note it should not detect // tablets because their display is large enough to use the desktop // version. + + // The stock intel site allows forcing mobile/full sites with a vp=m or vp=f + // parameter - let's support the same. (stock only allows this for some + // browsers - e.g. android phone/tablet. let's allow it for all, but + // no promises it'll work right) + var viewParam = getURLParam('vp'); + if (viewParam == 'm') return true; + if (viewParam == 'f') return false; + return navigator.userAgent.match(/Android.*Mobile/); }