iPhone Blog Support

So I made my blog pages redirect to a special iPhone/iPod touch version today.

It's not too tough. First off, I created the blog reader by using the Dashcode RSS Web Application template in the Dashcode version that shipped with the SDK.

I simply:
  1. Opened Dashcode
  2. Clicked on Web Application/RSS
  3. Clicked on RSS Properties in the Workflow Steps
  4. Set the Feed URL to the URL of the XML for my RSS Feed
  5. Set the Page Title to "Ryan's Blog"
  6. Changed the My RSS Feed in the Title to Ryan's Blog
  7. Added a mailto at the bottom of the footer, replacing the DEVELOPED WITH DASHCODE. I never was able to figure out how to embed it directly in the text, so I resorted to adding this in the main.js file:
    var footer = document.getElementById("footer");
    footer.innerHTML= 'Developed by <a href="mailto:myaddress">Ryan Martell</a>;
  8. Then I selected "Deploy Web Application..." from the File Menu, and saved it on my Desktop.


I could have stopped there, but following this suggestion (oops, I lost my history of where I got this suggestion from- sorry!), I added this javascript to my blog pages so that it would redirect iPhone and iPod's to my "special" version:

if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) && document.location.indexOf('.xml') == null)
{
  location.replace("/iPhoneBlog/index.html");
}


And it's all done! You can see it in action if you browse this page with your iPhone!