Skip to content

Commit

Permalink
Added option for supporting Retina and other high density devices by …
Browse files Browse the repository at this point in the history
…using an alternative JS snippet. (Thanks to Fabian Michael)
  • Loading branch information
MattWilcox committed Nov 10, 2011
1 parent b4eb375 commit 1153924
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion instructions.htm
Expand Up @@ -25,7 +25,10 @@ <h2>Basic instructions</h2>
<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)+'; 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>
<p>NOTE 1: if you would like to take advantage of high-pixel density devices such as the iPhone4's Retina display you can use the following JavaScript instead.
It will send higher-resolution images to such devices - be aware this will mean slower downloads for users.</p>
<pre><code>&lt;script&gt;document.cookie='resolution='+(Math.max(screen.width,screen.height)*("devicePixelRatio" in window ? devicePixelRatio : 1))+'; path=/';&lt;/script&gt;</code></pre>
<p>NOTE 2: 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>

<h2>You already have a .htaccess file</h2>
<p>I strongly advise you to duplicate that file so you can revert to it if things go pear-shaped.</p>
Expand Down

0 comments on commit 1153924

Please sign in to comment.