RSS

iPhone and Umbraco

Saturday, 31 July 2010

As iPhones become more and more popular client of the Interweb, more and more of our clients are looking to have content specifically rendered for the iPhone version of Safari.

Now, thanks to Tim Geyssens (who has done a tonne of nice work for Umbraco) this is very easy to achieve for our Umbraco clients.

Tim has created an iPhone template package that was easy to install (it comes as an installable Umbraco package) and use. The only tweaking I needed to do was to change some JavaScript for situations when the Umbraco install is using directory paths instead of file / .aspx paths. Here is what I changed:

<script language=javascript>

if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i)))

{

var suffix = "/iphone";

var startPos = location.href.length - suffix.length;

if (location.href.lastIndexOf(suffix , startPos) != startPos)

{

document.location.href=location.href + "/iphone";

}

}

</script>

As you can see, only a small tweak of JavaScript for the master template and its working a treat :) Nice work Tim!



This entry was written by Karl Kopp, posted on Saturday, 31 July 2010 Bookmark the permalink. Follow any comments here with the RSS feed for this post. You can post a comment.

Post a comment

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact me so we can take care of it!

Visit my friends!

A few highly recommended friends...

About

Some semi-interesting ramblings from a technology geek (me, Karl Kopp) about some future adventures...