iPhone Blog Support
17/03/08 13:34 Filed in: Technology
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:
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:
And it's all done! You can see it in action if you browse this page with your iPhone!
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:
- Opened Dashcode
- Clicked on Web Application/RSS
- Clicked on RSS Properties in the Workflow Steps
- Set the Feed URL to the URL of the XML for my RSS Feed
- Set the Page Title to "Ryan's Blog"
- Changed the My RSS Feed in the Title to Ryan's Blog
- 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>; - 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!