Simple iPhone5 detection with JavaScript

It’s really simple, just use this function:

function isIphone5(){
	function iOSVersion(){
		var agent = window.navigator.userAgent,
		start = agent.indexOf( 'OS ' );
		if( (agent.indexOf( 'iPhone' ) > -1) && start > -1)
			return window.Number( agent.substr( start + 3, 3 ).replace( '_', '.' ) );
		else return 0;
	return iOSVersion() >= 6 && window.devicePixelRatio >= 2 && screen.availHeight==548 ? true : false;

Now simply call isIphone5() which will return true if:

  • The device is an iPhone
  • and if iOS version is at least 6
  • and if the device has a retina display
  • and if the screen has a height of 548px

These conditions (currently) only apply to iPhone5.

If the user is not on iPhone5 the method will return false.

ZK user group conference in Mannheim, Germany

I’ll be speaking on the upcoming ZK user group conference in Mannheim, Germany on December 6th, 2011 (what’s ZK?).

If you enjoy developing rich internet applications with the power of Java, I highly recommend to be there.
If you want to join, just sign up for the event on for free and see three exciting presentations including ones from ZK head Timothy Clare and me.
Also, this is a great opportunity to meet other ZK developers and share some ideas and latest news in the community.

As a little teaser, here is the title sheet for my presentation.

One reason for using Flash instead of HTML5

I think, I finally found an answer to the question, why one should use Flash instead of HTML5: Binary sockets

Newer Flash Player versions allow developers to open binary socket connections, which is not possible using pure HTML5/JavaScript in the browser (HTML5 only supports websockets, which are different).

Thus, for example, it would not be possible to create a FTP client without Flash or a backend system since such an attempt would require one to open a socket in order to implement the FTP protocol.

Why use Flash instead of HTML5?

The guys had an interview with Adrian Ludwig, Flash Group Manager at Adobe Systems, and asked him what’s the benefit of the Flash platform compared to HTML5 and if Flash would ever come to the iPhone.

The answers are quite interesting.
After watching the video, I gotta say that Ludwig didn’t really have an answer to the question, what the benefit of Flash is (compared to HTML5). He mumbled something about “content-protection” (whatever he means by that), fast updating cycles (within 12 months?) and features which won’t be available even in newer versions of HTML (.. which would be?).

As much as I like to code using the Flex API, I think that the Flash Player has no future. It’s slow and has some serious security issues which makes it vulnerable for various exploits.

The only thing why Flash could be currently useful would be webcam support, but as far as I know, this feature has already been suggested for further versions of HTML.

So, at the moment I think that I’d more go for GWT instead of the Flash Builder to create Rich Internet Applications of any kind.

Update: Found the answer ;-)