Feeds

back to article How I wrote an iPhone application

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 …

COMMENTS

This topic is closed for new posts.

Not sure who u will piss off more

Java or Mac fanboi's, i think i can hear their foot steps coming in the distance, no wait its my team lead better start to look busy....

0
0

Ah! A blast from the past

In the spirit of the "retro" PET article, finally a code listing that we can type somewhere, and then wonder why it doesn't work. Do we get a "corrections" section in next month's issue?

0
0
Dan
Thumb Up

Useless?

This removes all references of the iphone from el reg - what's useless about that?

0
0
Anonymous Coward

Not just Safari

This also works fine using Opera. (It works on 9.24 under Linux anyway). I tried it yesterday to see what would happen and was most delighted when all mentions of the iPhone changed to 'crock of shite'...

0
0

A+ on Java Script...

F on HTML. WTF did you do? The page is a mess. Youve removed the %ages somehow! It may be somthing else, but I cant be botherd to surch your sorce code. It is hell to read.

0
0

Nice

Works on Opera under Windows too, although (surprise surprise) not IE7 (although I'm sure you could persuade MS to add functionality in if they know it's being used to have a dig at Apple). Nice to see it reported as the "SHiTEphone" after running the app :-)

0
0
Jobs Horns

@Michael Compton

Javascript isn't Java, and the Javascript fanbois are already pissed off because it's awful. Hopefully the Mac fanbois will already be just as pissed off because the iPhone is awful.

0
0

mile wide

article aside, why does it not wrap in my browser (the article, that is) - its about 2 screens (1024) wide? Someting to do with all the javascript you've put there? weird.

0
0

Utter tosh

Perhaps someone at El Reg who does not think that JavaScript is 'an annoying scripting language with aspirations of objecthood' should have attempted this task. This article seems to be a bitter stab at what the author considers a weak language, rather than an insight into builidng iPhone apps.

Having read to the end, it is clear that the author is unwilling or incapable of learning what is in-fact a very powerful language. I've not yet written an iPhone app, but if I did, I'm sure I would not need to use iFrames in my HTML markup, nor worry about page onload events, or the XmlHttpRequestObject. I'd use one of the popular JavaScript frameworks to do the plumbing - JQuery, Prototype, Dojo, and get rid of those global variables and functions.. maybe even use objects.

Bill. Stick to being a journalist. You're clearly not a developer. Mind you, based on this article, I'm not sure which you are worse at

0
0
Thumb Up

Worked on the N95

It worked well on my N95, and I was tickled with my preferred moniker of sack'o'shite... :)

0
0

Back button

IIRC, you should be able to address the back button issue by altering the window.history Array, as for the onLoad issue, search for the </body> and inject a <script>parentFrame.doOnLoad()</script>.

0
0
Thumb Down

XMLHttpRequest is a cross-browser standard

"XMLHttpRequest doesn't exist anywhere else"

You know, a simple Google search would have saved you from writing obvious nonsense.

http://en.wikipedia.org/wiki/XMLHttpRequest

0
0

Firefox

Works on FF too although the layout isn't quite right.

0
0

@ Shakje

You are most correct my pedantic friend and I stand corrected :) *tongue in check humour, no offence intended* :)

Though they are close enough for me not to particularily like either. Just personal preference though, more a desktop programmer than web, in the immortal words of BG 'it will never catch on' :).

0
0
Bronze badge

Half works.

Well, your lovely app seems to work with Safari on a Mac, but it completely fails in Firefox. Although why you'd write applications for the iGorilla is beyond me.

0
0
Silver badge
Thumb Down

And how is this an iPhone app?

I'm sorry if I'm being a bit of an old school kind of guy, but please someone explain to me how writing a javascript web page being an application which is loaded on to your iphone?

Did the definition of an application change when the IT press monikered web 2.0?

Not that I'm being critical of this little "hack" (again old school reference...)...

0
0
Joke

I'm sure I'm not missing the point here when I say:

<?php

$change_to = $_GET['change_to'];

$fp = fopen([document]);

$document = fread($fp , 10000000);

fclose($fp);

echo preg_replace("\biphone\b/i" , $change_to , $document);

?>

... and you don't have to have bloody iPhone either.

0
0
(Written by Reg staff) Gold badge

Re: Any 'Developer' Jobs going at el reg

James, you seemed to have skipped over the first paragraph.

Bill Ray is a hack, not a hacker. Our software developers will arm wrestle you any day.

0
0
Thumb Down

Any 'Developer' Jobs going at el reg

Hmm, doesn't know anything about XMLHttpRequest

Doesn't understand that Javascript does have objects and is a powerful prototype based language (although with many issues!)

Uses javascript global variables

Can't write a valid HTML page.

Uses 'old school' event handling

How much do people on this site get paid to write 'web apps'? I can do a lot better than this and I'm pretty woeful :-) Please let me know how much my salary will be

0
0
Silver badge
Flame

Javascript "language" ?

"it is clear that the author is unwilling or incapable of learning what is in-fact a very powerful language."

I reel in shock from the sudden IQ loss. All I have to say about JavaScript is what Joe Buchanan said about Frankenstein's Monster: "It's an abomination in the eyes of God".

Instead of dying as it should have, some wise-crack decided to "mate" the damn thing with Web Services, which were NEVER meant to be used by end-users, but instead for B2B EDI transactions, and create the AJAX "technology". Urggggh...

That said, its a useful app 'coz it blocks "iPhone" and its source code shows how shite the Javascript "language" is!

I prefer server-side Java (J2EE) or even client-side, as it'll run independently of your browser or OS.

0
0
Stop

@Javascript "language" ?

> I prefer server-side Java (J2EE) or even client-side, as it'll run independently of your browser or OS.

Right, because I really want to have to load an external VM and suck down huge quantities of memory and CPU cycles just to have a little interactivity on my web forms. On a mobile device even. That'll be sweet.

Seriously, yes Javascript has its fair share of problems - probably more than a lot of other common languages - but if you really think its object model is weak then you're doing it wrong. Go read a book - hell, a web page - and come back when you know something about the subject.

0
0
Flame

@By Daniel B.

Amen Brother.

The app can't even work consistently across versions of Safari, let alone play nice with IE and Opera!

Do everything server side and render nice HTML. A shame that javascript was never replaced by a client side equivalent of Java or PHP with access to the browser DOM....

0
0
Bronze badge

JQuery

Let me emphasise something an earlier commenter mentioned.

Use JQuery.

JQuery.

Don't not use JQuery.

http://jquery.com.

From someone who's happy that JQuery makes Javascript into a language that looks as though it was designed to interact with the DOM (CSS3 selectors, no less), rather than one that looks like Java, which clearly was not designed for this task.

0
0
Silver badge
Boffin

GreaseMonkey?

Sounds to me like your app does the sort of thing GreaseMonkey is very good at. If you could turn your app into a full GreaseMonkey thing, it might actually become popular.

0
0

Wake me when it's all over ...

ZZZZZZZZZZZZZZzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...................

0
0
Dead Vulture

I know I am going to get flamed for this but...

...I don't care.

Your article was, quite frankly, poor. You clearly did NOT research your subject matter before posting, somthing which is becomming more and more prevelant across dead reg.

The code is an abomination, whilst I won't get drawn into the JavaScript is shite debate (it is shite, but I have no need to qualify that statement) you could/should have at least made sure your code works properly. For a start it is possible to do what you have done on ANY half modern browser, any good developer of web based systems knows to make crosss browser capabilities a priority. But, your not a developer.

Once again a register posting that could have been somthing usefull, let down by lazy 'reporters' who have about as much IT knowledge as a cabbage...sort it out or close down.

0
0
Thumb Down

what has this gota do with an iphone ???????

This is a beginners guide to a javascript webpage. Thats it {shrug}

This has as much to do with an iphone as it does Windows CE, WML etc.

But then is that meant to be web-2.0 ironic ???

0
0
Bronze badge
Stop

hmm

Here's a useful resource for anyone that mistakenly thought this article would be useful for anything other than starting fires: http://groupaware.mobi/iphone/#_Samples

0
0
Paris Hilton

@M Gumby and anon.

Believe it or not, Jobs and Co. have actively tried to break any and all hacks letting people install their own software onto their own devices with each new firmware release. Despite Apple fans calling it a smartphone, it is not -- the end user cannot install their own apps. Apple's official method to write apps "for" the iphone is to do javascript, html, ajax, etc.

As for XmlHttpRequest, on paper it's standardized. In practice I keep reading about people having to throw in hacks to make it work properly on various browsers.

0
0
Thumb Up

Works in Konqueror

which might not be too much of a suprise.

Snags:

The buttons in the bottom frame are a bit over sized, and the couple of second delay while nothing happens.

0
0
This topic is closed for new posts.