Skip to content

Commit

Permalink
Fix for IE bug
Browse files Browse the repository at this point in the history
IE wasn't setting the cookie properly
  • Loading branch information
MattWilcox committed Sep 23, 2011
1 parent ae0c437 commit e2454dc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
7 changes: 5 additions & 2 deletions adaptive-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
11 changes: 11 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
version 1.3.2 (2011/09/06) ------------------------------------------------------------
Thanks to Oncle Tom

BUG FIXES
* Internet Explorer was not correctly setting the cookie, and thus breaking badly
* Fixed a possible Cookie Injection, and optimised ai-cookie.php

NOTES
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

Expand Down
2 changes: 1 addition & 1 deletion instructions.htm
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion instructions_de.htm
Original file line number Diff line number Diff line change
Expand Up @@ -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>
<pre><code>&lt;script&gt;document.cookie='resolution='+Math.max(screen.width,
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>
Expand Down

0 comments on commit e2454dc

Please sign in to comment.