iPhone Conspiracy Theory

I love a good conspiracy theory. Here’s one little paranoid thought that popped into my head the other day that would explain why Apple chose not to release an SDK (software developer kit) or support for Flash or Java in Safari. You see if you want to develop an application for the iPhone, Apple has limited it to webaps that run in Safari, which is great news for me but not so great for end users and software companies.

In a word, Skype.

My guess is that AT&T asked Apple to lock the iPhone down to prevent anyone from creating anything like Skype for iPhone. You see if Skype (or similar) could run on iPhone many of us would choose to use Skype over placing a costly cellular call. AT&T would loose millions in revenue.

Theoretically a version of Skype could be written in Flash or Java, so those two technologies had to be left unsupported too. Skype software normally runs right on the computer’s operating system so uncontrolled open development had to also be eliminated as an option. Theoretically someone could write an ajax (Javascript) version of Skype but since Javascript is parsed entirely by the browser, Apple could still theoretically block specific Javascript functions just like browsers block pop-ups.

Some may say, but what about Skype for Window Mobile? Good point but it is a different situation and could possibly be the very reason AT&T would want to prevent more of the same. There may be a lot more reasons Apple chose to not support Flash and Java and fail to release an SDK. But I think the Skype reason is reason enough.

iPhone Running Slow – Easy Fix

I ran into a little weirdness yesterday with my iPhone. The “slide to unlock” was running slow or not responding. A few other things seemed to be running slow too.Knowing that the iPhone is really just a tiny computer it seemed logical to restart it, which fixed the problem, duh. I did a quick search online and discovered a few other people had the same problem and found the same fix.

To do turn off your iPhone just power off (press and hold button on top right) and then turn it back on after it has shut down (press and hold same button). Still loving my iPhone by the way. Amazing little thing.

Mobile Device (iPhone too) Browser Sniffer

If you have a mobile website already you might have noticed that it looks terrible, tiny, and in the upper left corner on the iPhone.

You might be wondering how to modify your mobile website for the iPhone. I have a simple solution in PHP, but you’ll be able to adapt it to whatever language you like. Actually you could also just add a couple lines of code to your page <head> and CSS file if you don’t need the sniffing part.

The sniffer works by looking for the iPhone user agent and then inserting the appropriate code. I have not found anything official on Apple’s website yet on this topic but gleaned the necessary code for the iPhone from various blogs of people who attended a recent developer conference.

I believe all you need do is ad the following line to your <head>:

<meta name=”viewport” content=”width=320″ />

…and a width to your CSS file in the body {}:

width:320px;

Here is the sniffer:

$useragent=$_SERVER['HTTP_USER_AGENT'];

if(stristr($useragent, “iPhone”)){
$device_type=”iphone”;
}

if (isset($device_type) and $device_type==”iphone”){
$meta=”<meta name=\”viewport\” content=\”width=320\” />”;
$css=”iphone.css”;
}else{
$css=”styles.css”;
}

In my page template I have replacement objects for [META] and [CSS] and do a string replace (http://php.net/str_replace) for those objects with the variables about. You can probably do the same thing with javascript; I used PHP because it was easier for me.

In a nutshell I’ve found that if you add the following meta tag to your <head> and width:320px to your body in your CSS file the iPhone will render your mobile site correctly.

This is just a quick patch for existing mobile sites. A full blown iPhone site would require (ideally) a lot more work. I plan to ‘iPhone-ize’ a few of my sites and adapt them for the iPhone. I’ll post what I learn. In the mean time take a look at http://favfeed.com which had the META and CSS added. No sniffer, since this site is a mobile only site.