<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: iPhone 4 and iOS 4 Safari detection &amp; behavior</title>
	<atom:link href="http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport</link>
	<description>Techniques and best practices for delivering the best possible experience for each mobile device</description>
	<lastBuildDate>Mon, 23 Jan 2012 13:11:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: userAgent &#124; just study</title>
		<link>http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport/comment-page-1#comment-1180</link>
		<dc:creator>userAgent &#124; just study</dc:creator>
		<pubDate>Sat, 04 Dec 2010 11:47:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.mobilexweb.com/?p=15#comment-1180</guid>
		<description>[...] Bots vs Browsers &#8211; Public Bots and User Agents Database and Commentary Whats My User Agent? iPhone 4 and iOS 4 Safari detection &amp; behavior with CSS media queries, viewport and JavaScript t...   This entry was posted in javascript, php. Bookmark the [...]</description>
		<content:encoded><![CDATA[<p>[...] Bots vs Browsers &#8211; Public Bots and User Agents Database and Commentary Whats My User Agent? iPhone 4 and iOS 4 Safari detection &amp; behavior with CSS media queries, viewport and JavaScript t&#8230;   This entry was posted in javascript, php. Bookmark the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport/comment-page-1#comment-157</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Thu, 26 Aug 2010 02:37:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.mobilexweb.com/?p=15#comment-157</guid>
		<description>
            function init() {
                var winW, winH;

                if (window.devicePixelRatio)
                    setWidth(window.devicePixelRatio);

                if (parseInt(navigator.appVersion) &gt; 3) {
                    if (navigator.appName == &quot;Netscape&quot;) {
                        winW = window.innerWidth;
                        winH = window.innerHeight;
                    }
                    if (navigator.appName.indexOf(&quot;Microsoft&quot;) != -1) {
                        winW = document.body.offsetWidth;
                        winH = document.body.offsetHeight;
                    }
                }

                document.getElementById(&quot;size&quot;).innerHTML=&quot;&quot; + winW + &quot;x&quot; + winH + &quot;&quot;;
                if(window.devicePixelRatio)
                    document.getElementById(&quot;ratio&quot;).innerHTML=&quot;Pixel Ratio: &quot; + window.devicePixelRatio + &quot;&quot;;
            }

            function setWidth(ratio) {
                var winW
                if (parseInt(navigator.appVersion) &gt; 3) {
                    if (navigator.appName == &quot;Netscape&quot;)
                        winW = window.innerWidth;
                    if (navigator.appName.indexOf(&quot;Microsoft&quot;) != -1)
                        winW = document.body.offsetWidth;
                }
                winW = winW * ratio;
                var m = document.getElementById(&quot;vp&quot;);
                m.attributes[2].value = &quot;width=&quot; + winW + &quot;, initial-scale=&quot; + (1 / ratio) + &quot;, maximum-scale=&quot; + (1 / ratio) + &quot;&quot;;
            }
        


This works if in portrait mode when you startup. some additional code would make it work in landscape as well...

this will put the device into the mode to report actual pixel information, not the virtual pixel information.</description>
		<content:encoded><![CDATA[<p>function init() {<br />
                var winW, winH;</p>
<p>                if (window.devicePixelRatio)<br />
                    setWidth(window.devicePixelRatio);</p>
<p>                if (parseInt(navigator.appVersion) &gt; 3) {<br />
                    if (navigator.appName == &#8220;Netscape&#8221;) {<br />
                        winW = window.innerWidth;<br />
                        winH = window.innerHeight;<br />
                    }<br />
                    if (navigator.appName.indexOf(&#8220;Microsoft&#8221;) != -1) {<br />
                        winW = document.body.offsetWidth;<br />
                        winH = document.body.offsetHeight;<br />
                    }<br />
                }</p>
<p>                document.getElementById(&#8220;size&#8221;).innerHTML=&#8221;" + winW + &#8220;x&#8221; + winH + &#8220;&#8221;;<br />
                if(window.devicePixelRatio)<br />
                    document.getElementById(&#8220;ratio&#8221;).innerHTML=&#8221;Pixel Ratio: &#8221; + window.devicePixelRatio + &#8220;&#8221;;<br />
            }</p>
<p>            function setWidth(ratio) {<br />
                var winW<br />
                if (parseInt(navigator.appVersion) &gt; 3) {<br />
                    if (navigator.appName == &#8220;Netscape&#8221;)<br />
                        winW = window.innerWidth;<br />
                    if (navigator.appName.indexOf(&#8220;Microsoft&#8221;) != -1)<br />
                        winW = document.body.offsetWidth;<br />
                }<br />
                winW = winW * ratio;<br />
                var m = document.getElementById(&#8220;vp&#8221;);<br />
                m.attributes[2].value = &#8220;width=&#8221; + winW + &#8220;, initial-scale=&#8221; + (1 / ratio) + &#8220;, maximum-scale=&#8221; + (1 / ratio) + &#8220;&#8221;;<br />
            }</p>
<p>This works if in portrait mode when you startup. some additional code would make it work in landscape as well&#8230;</p>
<p>this will put the device into the mode to report actual pixel information, not the virtual pixel information.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport/comment-page-1#comment-156</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Thu, 26 Aug 2010 00:44:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.mobilexweb.com/?p=15#comment-156</guid>
		<description>I use this in javascript for detection:

var iPhone4 = false;
if(window.devicePixelRatio &amp;&amp; window.devicePixelRatio == 2) { iPhone4 = true; }

I forget what site I found it on, but it might be useful to add here too.</description>
		<content:encoded><![CDATA[<p>I use this in javascript for detection:</p>
<p>var iPhone4 = false;<br />
if(window.devicePixelRatio &amp;&amp; window.devicePixelRatio == 2) { iPhone4 = true; }</p>
<p>I forget what site I found it on, but it might be useful to add here too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lalo</title>
		<link>http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport/comment-page-1#comment-141</link>
		<dc:creator>Lalo</dc:creator>
		<pubDate>Wed, 18 Aug 2010 15:07:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.mobilexweb.com/?p=15#comment-141</guid>
		<description>Hi, I&#039;m experiencing the same issues as Nick when using an Iphone 4. It just ignores the meta tags...</description>
		<content:encoded><![CDATA[<p>Hi, I&#8217;m experiencing the same issues as Nick when using an Iphone 4. It just ignores the meta tags&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Pavlak</title>
		<link>http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport/comment-page-1#comment-138</link>
		<dc:creator>Nick Pavlak</dc:creator>
		<pubDate>Mon, 16 Aug 2010 20:32:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.mobilexweb.com/?p=15#comment-138</guid>
		<description>I also tried device-width with a min/max scale of 0.5 which does not work either.</description>
		<content:encoded><![CDATA[<p>I also tried device-width with a min/max scale of 0.5 which does not work either.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Pavlak</title>
		<link>http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport/comment-page-1#comment-137</link>
		<dc:creator>Nick Pavlak</dc:creator>
		<pubDate>Mon, 16 Aug 2010 20:30:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.mobilexweb.com/?p=15#comment-137</guid>
		<description>Yeah I tried device-width as well, and to no avail.  I even tried a variety of different things such as making the viewport intentionally too large.  And while these changes all reflect in Safari, no matter what I do the webapp ignores the viewport meta tag all together, and just makes the image 960x640 no matter what.</description>
		<content:encoded><![CDATA[<p>Yeah I tried device-width as well, and to no avail.  I even tried a variety of different things such as making the viewport intentionally too large.  And while these changes all reflect in Safari, no matter what I do the webapp ignores the viewport meta tag all together, and just makes the image 960&#215;640 no matter what.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: firt</title>
		<link>http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport/comment-page-1#comment-135</link>
		<dc:creator>firt</dc:creator>
		<pubDate>Mon, 16 Aug 2010 19:52:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.mobilexweb.com/?p=15#comment-135</guid>
		<description>Hi Nick, are you using width=device-width inside the viewport? Don&#039;t use the real resolution inside the viewport</description>
		<content:encoded><![CDATA[<p>Hi Nick, are you using width=device-width inside the viewport? Don&#8217;t use the real resolution inside the viewport</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Pavlak</title>
		<link>http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport/comment-page-1#comment-134</link>
		<dc:creator>Nick Pavlak</dc:creator>
		<pubDate>Mon, 16 Aug 2010 19:50:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.mobilexweb.com/?p=15#comment-134</guid>
		<description>So here is my problem...  This webapp is set up and looks great in the browser, and on older models of the iPhone.  However with the iPhone 4 when made into a webapp, it defaults to full resolution which makes it impossible to view on the phone.  I&#039;ve tried just about every solution I could find, and still nothing works.

Why is it ignoring the viewport command in webapp mode?  Is there any way to make it recognize the viewport?</description>
		<content:encoded><![CDATA[<p>So here is my problem&#8230;  This webapp is set up and looks great in the browser, and on older models of the iPhone.  However with the iPhone 4 when made into a webapp, it defaults to full resolution which makes it impossible to view on the phone.  I&#8217;ve tried just about every solution I could find, and still nothing works.</p>
<p>Why is it ignoring the viewport command in webapp mode?  Is there any way to make it recognize the viewport?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zoe Gillenwater</title>
		<link>http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport/comment-page-1#comment-67</link>
		<dc:creator>Zoe Gillenwater</dc:creator>
		<pubDate>Mon, 19 Jul 2010 13:09:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.mobilexweb.com/?p=15#comment-67</guid>
		<description>&lt;a href=&quot;#comment-12&quot; rel=&quot;nofollow&quot;&gt;@Taylor Durham&lt;/a&gt; 
I have run into this in the past too, Taylor. IIRC, the way to fix it is to change your meta viewport tag from plain meta name=&quot;viewport&quot; content=&quot;width=device-width&quot; to meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0, maximum-scale=1.0&quot;.</description>
		<content:encoded><![CDATA[<p><a href="#comment-12" rel="nofollow">@Taylor Durham</a><br />
I have run into this in the past too, Taylor. IIRC, the way to fix it is to change your meta viewport tag from plain meta name=&#8221;viewport&#8221; content=&#8221;width=device-width&#8221; to meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1.0, maximum-scale=1.0&#8243;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ester Pokswinski</title>
		<link>http://www.mobilexweb.com/blog/iphone4-ios4-detection-safari-viewport/comment-page-1#comment-54</link>
		<dc:creator>Ester Pokswinski</dc:creator>
		<pubDate>Wed, 14 Jul 2010 18:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.mobilexweb.com/?p=15#comment-54</guid>
		<description>I really like what you write about here. I try and visit it every day so keep up the good writing!</description>
		<content:encoded><![CDATA[<p>I really like what you write about here. I try and visit it every day so keep up the good writing!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

