Feeds

How I wrote an iPhone application

An introduction to the world of mobile Web 2.0

Eight steps to building an HP BladeSystem

If an El Reg hack can write an iPhone application then anyone can, so we thought we'd have a go and pass on our experience in the hope that others can build something more useful.

In proper Web 2.0 fashion we decided to create an application which would achieve nothing and have no commercial potential. Therefore, our application would load The Register website and parse its contents to remove all references to the ubiquitous iPhone, replacing the term with a string of the user's choice.

First thing was to download the iPhone documentation from the Apple Developer Connection, which required us to sign up with a valid email address and left us with a small pile of pdf documents to read.

Unfortunately, these documents proved almost entirely useless as they talked at length about the style and usability of iPhone applications, but said very little about how to write them. The JavaScript guides were a bit more useful, but not a lot, and we got more mileage out of our rather elderly "JavaScript Definitive Guide" (circa 1997) and various JavaScript websites.

We also needed to download the latest version of Safari - you're supposed to be able to develop using Safari then deploy straight onto an iPhone, though life is not really that simple, and that does need XP or Vista (or a nice Mac, but our budget wouldn't stretch).

Assuming one isn't going down the native-applications-for-unlocked-iPhones-only route, then iPhone applications are written in JavaScript - an annoying scripting language with aspirations of objecthood and no significant relationship to Java. JavaScripts can't live alone - they are embedded in web pages - but as we wanted our app to load other web pages we made that page a frameset (which can contain other pages).

All our development was done using PFE - we eschewed more complex environments for what should be a bit of quick text editing.

Initially, our frameset only contained a single frame, to load the El Reg pages into, but we had to add a second frame when it became clear that the iPhone's "back" button wasn't going to operate as we would have liked. But even with the second frame for the menu bar our HTML page managed to keep it simple:

<HTML>
  <HEAD>
    <TITLE>Test using frames</TITLE>
    //JavaScript goes here
  </HEAD>
  <FRAMESET ROWS="*,32" FRAMEBORDER="no" onLoad="startUp();">
    <FRAME SRC="blank1.html" NAME="left">
    <FRAME SRC="menubar.html" name="menu">
  </FRAMESET>
</HTML>

Then it was just a matter of inserting our script into the header with a function called "startUp" to be run when the page had loaded, the script is listed in its entirety at the end of this article. blank1.html is just a holding text, while menubar.html contains our additional back button and an option to change the replacement text.

Securing Web Applications Made Simple and Scalable

More from The Register

next story
Auntie remains MYSTIFIED by that weekend BBC iPlayer and website outage
Still doing 'forensics' on the caching layer – Beeb digi wonk
Apple orders huge MOUNTAIN of 80 MILLION 'Air' iPhone 6s
Bigger, harder trouser bulges foretold for fanbois
GoTenna: How does this 'magic' work?
An ideal product if you believe the Earth is flat
Telstra to KILL 2G network by end of 2016
GSM now stands for Grave-Seeking-Mobile network
Seeking LTE expert to insert small cells into BT customers' places
Is this the first step to a FON-a-like 4G network?
Yorkshire cops fail to grasp principle behind BT Fon Wi-Fi network
'Prevent people that are passing by to hook up to your network', pleads plod
BlackBerry: Toss the server, mate... BES is in the CLOUD now
BlackBerry Enterprise Services takes aim at SMEs - but there's a catch
Bring back error correction, say Danish 'net boffins
We don't need no steenkin' TCP/IP retransmission and the congestion it causes
prev story

Whitepapers

Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Top 8 considerations to enable and simplify mobility
In this whitepaper learn how to successfully add mobile capabilities simply and cost effectively.
Seven Steps to Software Security
Seven practical steps you can begin to take today to secure your applications and prevent the damages a successful cyber-attack can cause.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.