Feeds

How I wrote an iPhone application

An introduction to the world of mobile Web 2.0

3 Big data security analytics techniques

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.

Top three mobile application threats

More from The Register

next story
Virgin Media so, so SORRY for turning spam fire-hose on its punters
Hundreds of emails flood inboxes thanks to gaffe
A black box for your SUITCASE: Now your lost luggage can phone home – quite literally
Breakfast in London, lunch in NYC, and your clothes in Peru
AT&T threatens to pull out of FCC wireless auctions over purchase limits
Company wants ability to buy more spectrum space in auction
Turnbull leaves Australia's broadband blackspots in the dark
New Statement of Expectations to NBN Co offers get-out clauses for blackspot builds
Facebook claims 100 MEEELLION active users in India
Who needs China when you've got the next billion in your sights?
Facebook splats in-app chat, whacks brats into crack yakety-yak app
Jibber-jabbering addicts turfed out just as Zuck warned
Google looks to LTE and Wi-Fi to help it lube YouTube tubes
Bandwidth hogger needs tube embiggenment if it's to succeed
prev story

Whitepapers

SANS - Survey on application security programs
In this whitepaper learn about the state of application security programs and practices of 488 surveyed respondents, and discover how mature and effective these programs are.
Combat fraud and increase customer satisfaction
Based on their experience using HP ArcSight Enterprise Security Manager for IT security operations, Finansbank moved to HP ArcSight ESM for fraud management.
The benefits of software based PBX
Why you should break free from your proprietary PBX and how to leverage your existing server hardware.
Top three mobile application threats
Learn about three of the top mobile application security threats facing businesses today and recommendations on how to mitigate the risk.
3 Big data security analytics techniques
Applying these Big Data security analytics techniques can help you make your business safer by detecting attacks early, before significant damage is done.