<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>iPhoneGeek 爱疯极客 &#187; 网站开发</title>
	<atom:link href="http://www.iphone-geek.cn/tag/%e7%bd%91%e7%ab%99%e5%bc%80%e5%8f%91/feed" rel="self" type="application/rss+xml" />
	<link>http://www.iphone-geek.cn</link>
	<description>iPhone 新闻，编程，技巧与提示，代码，教程</description>
	<lastBuildDate>Sun, 25 Jul 2010 13:49:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>使用Javascript和PHP检测iPhone/iPod的使用</title>
		<link>http://www.iphone-geek.cn/%e7%bd%91%e9%a1%b5%e8%ae%be%e8%ae%a1/%e4%bd%bf%e7%94%a8javascript%e5%92%8cphp%e6%a3%80%e6%b5%8biphoneipod%e7%9a%84%e4%bd%bf%e7%94%a8</link>
		<comments>http://www.iphone-geek.cn/%e7%bd%91%e9%a1%b5%e8%ae%be%e8%ae%a1/%e4%bd%bf%e7%94%a8javascript%e5%92%8cphp%e6%a3%80%e6%b5%8biphoneipod%e7%9a%84%e4%bd%bf%e7%94%a8#comments</comments>
		<pubDate>Thu, 17 Jun 2010 02:53:02 +0000</pubDate>
		<dc:creator>bagusflyer</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[网站开发]]></category>
		<category><![CDATA[提示与技巧]]></category>
		<category><![CDATA[代码片段]]></category>

		<guid isPermaLink="false">http://www.iphone-geek.cn/?p=967</guid>
		<description><![CDATA[这与iPhone编程无关，不过当你的网站需要为iPhone/iPod进行优化时，可能会需要使用下面的技术：

使用Javascript检测是否正在使用iPhone 和 iPod

如果你的网页需要支持iPhone和iPod Touch，首先你必须检测到是否正在使用iPhone和iPod Touch，这样你才可能为其使用特定的代码或样页式。下列代码段使用Javascript来检测iPhone/iPod Touch的使用，从而将网页重定向iPhone相关的网页。

123456&#60;br /&#62;
if&#40;&#40;navigator.userAgent.match&#40;/iPhone/i&#41;&#41; &#124;&#124; &#40;navigator.userAgent.match&#40;/iPod/i&#41;&#41;&#41; &#123;&#60;br /&#62;
&#160; &#160; if &#40;document.cookie.indexOf&#40;&#34;iphone_redirect=false&#34;&#41; == -1&#41; &#123;&#60;br /&#62;
&#160; &#160; &#160; &#160; window.location = &#34;http://m.espn.go.com/wireless/?iphone&#38;i=COMR&#34;;&#60;br /&#62;
&#160; &#160; &#125;&#60;br /&#62;
&#125;&#60;br /&#62;

 
使用PHP检测是否正在使用 iPhone 和 iPod

有时在iPhone上，Javascript被禁止使用。为检测到iPhone/iPod Touch的使用，你需要使用下列PHP代码：

12345&#60;br /&#62;
if&#40;strstr&#40;$_SERVER&#91;'HTTP_USER_AGENT'&#93;,'iPhone'&#41; &#124;&#124; strstr&#40;$_SERVER&#91;'HTTP_USER_AGENT'&#93;,'iPod'&#41;&#41; &#123;&#60;br /&#62;
&#160; &#160; header&#40;'Location: http://yoursite.com/iphone'&#41;;&#60;br /&#62;
&#160; &#160; exit&#40;&#41;;&#60;br /&#62;
&#125;&#60;br /&#62;
]]></description>
			<content:encoded><![CDATA[<p>这与iPhone编程无关，不过当你的网站需要为iPhone/iPod进行优化时，可能会需要使用下面的技术：</p>
<p><br class="spacer_" /></p>
<h2>使用Javascript检测是否正在使用iPhone 和 iPod</h2>
<p><br class="spacer_" /></p>
<p>如果你的网页需要支持iPhone和iPod Touch，首先你必须检测到是否正在使用iPhone和iPod Touch，这样你才可能为其使用特定的代码或样页式。下列代码段使用Javascript来检测iPhone/iPod Touch的使用，从而将网页重定向iPhone相关的网页。</p>
<p><br class="spacer_" /></p>
<p><div class="codecolorer-container java mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>navigator.<span style="color: #006633;">userAgent</span>.<span style="color: #006633;">match</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span>iPhone<span style="color: #339933;">/</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span>navigator.<span style="color: #006633;">userAgent</span>.<span style="color: #006633;">match</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span>iPod<span style="color: #339933;">/</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>document.<span style="color: #006633;">cookie</span>.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;iphone_redirect=false&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; window.<span style="color: #006633;">location</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://m.espn.go.com/wireless/?iphone&amp;i=COMR&quot;</span><span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span></div></td></tr></tbody></table></div>
</p>
<h2> </h2>
<h2>使用PHP检测是否正在使用 iPhone 和 iPod</h2>
<p><br class="spacer_" /></p>
<p>有时在iPhone上，Javascript被禁止使用。为检测到iPhone/iPod Touch的使用，你需要使用下列PHP代码：</p>
<p><br class="spacer_" /></p>
<p><div class="codecolorer-container php mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/strstr"><span style="color: #990000;">strstr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'iPhone'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/strstr"><span style="color: #990000;">strstr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'iPod'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: http://yoursite.com/iphone'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span></div></td></tr></tbody></table></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphone-geek.cn/%e7%bd%91%e9%a1%b5%e8%ae%be%e8%ae%a1/%e4%bd%bf%e7%94%a8javascript%e5%92%8cphp%e6%a3%80%e6%b5%8biphoneipod%e7%9a%84%e4%bd%bf%e7%94%a8/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>建立自己的iPhone WebApp</title>
		<link>http://www.iphone-geek.cn/%e6%96%b0%e9%97%bb/%e5%bb%ba%e7%ab%8b%e8%87%aa%e5%b7%b1%e7%9a%84iphone-webapp</link>
		<comments>http://www.iphone-geek.cn/%e6%96%b0%e9%97%bb/%e5%bb%ba%e7%ab%8b%e8%87%aa%e5%b7%b1%e7%9a%84iphone-webapp#comments</comments>
		<pubDate>Sun, 29 Nov 2009 06:14:26 +0000</pubDate>
		<dc:creator>bagusflyer</dc:creator>
				<category><![CDATA[新闻]]></category>
		<category><![CDATA[网站开发]]></category>

		<guid isPermaLink="false">http://www.iphone-geek.cn/?p=356</guid>
		<description><![CDATA[想要开发一个自己的iPhone WebApplication吗？一切从头开始当然是可行的，不过却是费时费力的。iWebKit可以帮助我们十分钟就建立一个iPhone/iPod Touch兼容的网站，而且你不需要有太多的建网知识。另外，它还提供了Wordpress，Drupal等插件以及各种模板使你的iPhone/iPod Touch网站更具个性。不过目前还没有Joomla的插件。
详情见iWebKit网站。
]]></description>
			<content:encoded><![CDATA[<p>想要开发一个自己的iPhone WebApplication吗？一切从头开始当然是可行的，不过却是费时费力的。iWebKit可以帮助我们十分钟就建立一个iPhone/iPod Touch兼容的网站，而且你不需要有太多的建网知识。另外，它还提供了Wordpress，Drupal等插件以及各种模板使你的iPhone/iPod Touch网站更具个性。不过目前还没有Joomla的插件。</p>
<p>详情见<a href="http://iwebkit.net/">iWebKit网站</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphone-geek.cn/%e6%96%b0%e9%97%bb/%e5%bb%ba%e7%ab%8b%e8%87%aa%e5%b7%b1%e7%9a%84iphone-webapp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
