Browse files

Fix for IE bug

IE wasn't setting the cookie properly
  • Loading branch information...
MattWilcox committed Sep 23, 2011
1 parent ae0c437 commit e2454dcc1e26de7d242b69ab19593bee43e215e9
Showing with 18 additions and 4 deletions.
  1. +5 −2 adaptive-images.php
  2. +11 −0 changelog.txt
  3. +1 −1 instructions.htm
  4. +1 −1 instructions_de.htm
@@ -93,8 +93,11 @@ function browser_detect(){
return $name;
-/* Do we need to switch mobile first off? */
-if(browser_detect() == "gecko"){
+/* Do we need to switch mobile first off?
+ NOTE: Internet Explorer doesn't set the cookie fast enough and on the first request acts as though no cookie was set
+ For this reason we disable mobile-first under IE otherwise the majority of desktop users would see a bad result
+ on the first page load */
+if(browser_detect() == "msie"){
$mobile_first = FALSE;
@@ -1,3 +1,14 @@
+version 1.3.2 (2011/09/06) ------------------------------------------------------------
+ Thanks to Oncle Tom
+ * Internet Explorer was not correctly setting the cookie, and thus breaking badly
+ * Fixed a possible Cookie Injection, and optimised ai-cookie.php
+ In testing it seems that Firefox is now behaving properly and setting the cookie
+ in time. Thus, I've re-instated support for $mobile_first = TRUE on that browser
version 1.3.1 (2011/09/06) ------------------------------------------------------------
Thanks to Emilio Bravo
@@ -23,7 +23,7 @@ <h2>Basic instructions</h2>
<p>Copy <code>adaptive-images.php</code> and <code>.htaccess</code> into the root directory of your site. If you already have a htaccess file DO NOT OVERWRITE IT, skip down to the advanced instructions.</p>
<p>Create a directory called <code>ai-cache</code> in the root of your site and give it write permissions (CHMOD 777).</p>
<p>Copy the following Javascript into the &lt;head&gt; of your site. It MUST go in the head because it needs to work before the page has finished loading, and before any images have been requested.</p>
-<pre><code>&lt;script&gt;document.cookie='resolution='+Math.max(screen.width,screen.height)+'; expires=; path=/';&lt;/script&gt;</code></pre>
+<pre><code>&lt;script&gt;document.cookie='resolution='+Math.max(screen.width,screen.height)+'; path=/';&lt;/script&gt;</code></pre>
<p>That's it, you're done.</p>
<p>NOTE: you do not need the <code>ai-cookie.php</code> file unless you are using the <a href="#alternate">alternate method</a> of detecting the users screen size. So delete it if you like, no one likes mess.</p>
@@ -29,7 +29,7 @@ <h2>Basis Anweisungen</h2>
Das Script MUSS sich im head Bereich befinden damit es ausgeführt wird bevor
die gesamte Seite geladen ist und die ersten Bilder vom Server ausgeliefert werden.</p>
-screen.height)+'; expires=; path=/';&lt;/script&gt;</code></pre>
+screen.height)+'; path=/';&lt;/script&gt;</code></pre>
<p>Das wars. Sie sind fertig</p>
<p>ANMERKUNG: Die <code>ai-cookie.php</code> Datei wird normalerweise nicht
benötigt. Nur beim Einsatz der <a href="#alternate">Alternativen Methode</a>

0 comments on commit e2454dc

Please sign in to comment.