diff options
author | Christian Schneider | 2011-01-26 16:34:33 +0000 |
---|---|---|
committer | Christian Schneider | 2011-01-26 16:34:33 +0000 |
commit | 0716fc1ddaff47bdd7a944d109215f3bcb64103f (patch) | |
tree | 474fb1ae0ac96fc21f61e3de57ddc8344460a61e | |
parent | b13746cf4359252f34a68959c3247845b845150b (diff) | |
download | itools-0716fc1ddaff47bdd7a944d109215f3bcb64103f.tar.gz itools-0716fc1ddaff47bdd7a944d109215f3bcb64103f.tar.bz2 itools-0716fc1ddaff47bdd7a944d109215f3bcb64103f.zip |
Always fall back to script tag on iOS devices as it does not use cache, fix script fallback (do not use obfuscation for proxies)
-rw-r--r-- | itjs.php | 3 | ||||
-rw-r--r-- | itjs/boot.js | 23 |
2 files changed, 15 insertions, 11 deletions
@@ -70,7 +70,8 @@ if ($checksum != $_SERVER['HTTP_IF_NONE_MATCH']) if ($_REQUEST['boot']) { $data .= "window.it_boot_init();\n"; - $data = sprintf("/*sln:%d*/\n%s/*eln:%d*/", strlen($data), strtr($data, array('%' => "%25", '.' => "%2e", 'e' => "%65", 'i' => "%69")), strlen($data)); # Protect from Firewalls/Proxies altering Javascript source code + if (!$_REQUEST['script']) + $data = sprintf("/*sln:%d*/\n%s/*eln:%d*/", strlen($data), strtr($data, array('%' => "%25", '.' => "%2e", 'e' => "%65", 'i' => "%69")), strlen($data)); # Protect from Firewalls/Proxies altering Javascript source code } echo it_untaint($data); diff --git a/itjs/boot.js b/itjs/boot.js index 50e7a26..059bd78 100644 --- a/itjs/boot.js +++ b/itjs/boot.js @@ -163,16 +163,19 @@ function it_boot_getloader() { var result = null; - try - { - result = new XMLHttpRequest(); - } - catch (e) + if (!navigator.userAgent.match(/iPhone|iP.d/)) // Do not use XMLHttpRequest on iOS devices as it does not use cache { - var classnames = [ 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP' ]; + try + { + result = new XMLHttpRequest(); + } + catch (e) + { + var classnames = [ 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP' ]; - for (var i in classnames) - try { result = new ActiveXObject(classnames[i]); break; } catch (e) {} + for (var i in classnames) + try { result = new ActiveXObject(classnames[i]); break; } catch (e) {} + } } return result; @@ -233,11 +236,11 @@ function it_boot(file, isretry) it_boot.sequence += "n"; if (window.opera || (document.all && navigator.platform.indexOf("Mac") >= 0)) - document.write('<sc'+'ript type="text/javascript" src="'+it_boot_addparam(file, 'boot=1')+'"><\/sc'+'ript>'); + document.write('<sc'+'ript type="text/javascript" src="'+it_boot_addparam(file, 'boot=1&script=1')+'"><\/sc'+'ript>'); else if (dom) { var tag = doc.createElement("script"); - tag.src = it_boot_addparam(file, 'boot=1&retry=1'); + tag.src = it_boot_addparam(file, 'boot=1&script=1&retry=1'); dom.appendChild(tag); } else |