<?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>Jochem Prins &#187; Programming</title>
	<atom:link href="http://www.jochemprins.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jochemprins.com</link>
	<description>about search, Web2.0 and things I like</description>
	<lastBuildDate>Sun, 20 Sep 2009 11:28:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mobile device detection with PHP: 2 methods compared</title>
		<link>http://www.jochemprins.com/2008/09/30/mobile-device-detection-with-php-2-methods-compared/</link>
		<comments>http://www.jochemprins.com/2008/09/30/mobile-device-detection-with-php-2-methods-compared/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 22:03:24 +0000</pubDate>
		<dc:creator>Jochem</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[mobile device detection]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.jochemprins.com/?p=117</guid>
		<description><![CDATA[I&#8217;ve been working on a mobile version of the (dutch) translation website I founded. Apart from releasing the mobile site itself, it&#8217;s of course also important to make people aware of the existence of it. That&#8217;s exactly the reason why I started looking for a script that performs mobile device detection. The aim of such [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a mobile version of the (dutch) <a title="vertalen.nu" href="http://www.vertalen.nu" target="_blank">translation website</a> I founded. Apart from releasing the mobile site itself, it&#8217;s of course also important to make people aware of the existence of it. That&#8217;s exactly the reason why I started looking for a script that performs mobile device detection. The aim of such a script is to detect who visits the www-version of my website with a mobile device and automatically redirect those visitors to the mobile site.</p>
<p>Within a couple of minutes I already found a couple of php-scripts that perform the trick. After reading through the code and checking some comments on blogs I ended up with two candidates:</p>
<p>1) <a href="http://mobiforge.com/developing/story/lightweight-device-detection-php" target="_blank">A script by Andy Moore on mobiForge </a><br />
2) <a href="http://www.russellbeattie.com/blog/mobile-browser-detection-in-php" target="_blank">A script by Russell Beattie</a></p>
<p>That left me with the next dillema, which one to pick?</p>
<p><span id="more-117"></span></p>
<p>In order to answer this question, I defined the 2 main criteria that are important for the implementation on my website:</p>
<p>1) Code execution time: on a high traffic website, you want the code to be as efficient as possible<br />
2) Mobile device coverage: detect as many mobile devices as possible (coverage)</p>
<p>This is probably a good time to mention the great <a href="http://wurfl.sourceforge.net/" target="_blank">WURFL project</a> (open-source). WURFL is absolutely a great resource when you&#8217;re developing for mobile devices. Essentially, it&#8217;s a XML configuration file which contains information     about capabilities and features of many mobile devices. I used this resource for testing the scripts above.</p>
<p><strong>Testing and results</strong></p>
<p>For both candidates, I looped through all user-agents in the WURFL file (9457) and tested:<br />
- the average time required to check if this user-agent belongs to  mobile device or not<br />
- if this user-agent is detected as a mobile device or not</p>
<p>And the results are&#8230;</p>
<p>Average execution time<br />
- mobiForge script: 0,0078 seconds<br />
- Russell&#8217;s script: <span style="color: #008000;">0,0021 seconds</span></p>
<p>Device coverage<br />
- mobiForge scripts: <span style="color: #008000;">82,8%</span><br />
- Russell&#8217;s scripts: 81,9%</p>
<p>In other words, Russell&#8217;s script runs faster but the script from mobiForge has a slightly better coverage. However, I think the small difference in coverage can almost be neglected since the biggest part of the mobile web users are all using one of the popular mobile devices (N95, HTCs etc). Both scripts have absolutely no problem detecting these. Furthermore, you can easily extend the list of mobile user-agents in both scripts (I already added the iPhone). Based on these findings, I decided to implement Russell&#8217;s script and it&#8217;s working just fine.</p>
<p>Oh&#8230; and in case you&#8217;re wondering, the mobile version of <a href="http://www.vertalen.nu">vertalen.nu</a> will be released within the coming week.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jochemprins.com/2008/09/30/mobile-device-detection-with-php-2-methods-compared/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Cross-browser &#8216;bookmark this site&#8217; script</title>
		<link>http://www.jochemprins.com/2007/03/26/cross-browser-bookmark-this-site-script/</link>
		<comments>http://www.jochemprins.com/2007/03/26/cross-browser-bookmark-this-site-script/#comments</comments>
		<pubDate>Mon, 26 Mar 2007 17:15:48 +0000</pubDate>
		<dc:creator>Jochem</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.jochemprins.com/2007/03/26/cross-browser-bookmark-this-site-script/</guid>
		<description><![CDATA[I always thought that only Microsoft Internet Explorer supported a &#8216;bookmark this site&#8217; functionality. By doing some research on the web I found a few code snippets that did the trick for other browsers as well. I compiled these scripts together in the following bookmarkthis(title, url) function. It&#8217;s completely cross-browser (compatible with IE4+, Firefox 1.x+ [...]]]></description>
			<content:encoded><![CDATA[<p>I always thought that only Microsoft Internet Explorer supported a &#8216;bookmark this site&#8217; functionality. By doing some research on the web I found a few code snippets that did the trick for other browsers as well. I compiled these scripts together in the following <code>bookmarkthis(title, url)</code> function. It&#8217;s completely cross-browser (compatible with IE4+, Firefox 1.x+ and Opera7+). Have fun with it!</p>
<pre>
<code>
function bookmarkthis(title,url) {
  if (window.sidebar) { // firefox
     window.sidebar.addPanel(title, url, "");
  } else if (document.all) { // IE
     window.external.AddFavorite(url, title);
  } else if (window.opera &#038;&#038; window.print) { // opera
     var elem = document.createElement('a');
     elem.setAttribute('href',url);
     elem.setAttribute('title',title);
     elem.setAttribute('rel','sidebar');
     elem.click();
  }
}
</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jochemprins.com/2007/03/26/cross-browser-bookmark-this-site-script/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
