Archive for the ‘code’ Category

Directing mobile users to mobile site

It is becoming increasingly popular to automatically redirect mobile users to a mobile optimised site when accessing a desktop web url. This is usually done server side. For the more advanced browsers, the Safari on iPhone or Androids for example, you can also use a javascript to redirect the user. Such a script could look something like this:

<script language=javascript>
 if((navigator.userAgent.match(/iPhone/i)) ||
    (navigator.userAgent.match(/iPod/i))){
       if(confirm('Hey, is it an apple in your hand? Go to the mobile site?'))
	 location.replace("URL HERE");
  }
</script>

This will create a popup asking the user whether he/she would like to go to the mobile site. Handy stuff.

Tags: ,
Posted in code, mobile thoughts |

mobile lbs, js library to the rescue

I while back I wrote a blog post on Mobiforge on different ways of getting location information from the user/device (which by the way made it all the way to the mobiforge newsletter :) ).
Not surprisingly, our friend device fragmentation has joined the party.

For many reasons, this kind of stuff is not so easy to solve server side using wurfl or device atlas because we are talking javascript apis and installable and/or optional software/functions in many cases.

whoisstan wrote a nice, device independent javascript that handles this very nicely. Have a look here. Nice work. I might have some contributions up my sleve as well

Tags: ,
Posted in code |

Playing with geoip

Have been playing with MaxMinds free geoip lookup tool. Its pretty OK. The quality, as far as I have tested, is pretty good!

More than good enough to use in location aware mobile services. Ofcourse you have the issue with looking up location of the operators gateway when the user is connected throgh the telco network… Have a look at your own location here.

Tags: , ,
Posted in code, mobile thoughts |

Shorter URLs for mobile

Have been using twitter for a while now, and was annoyed by the tinyurls being useless on my mobile. So, I thought; how hard can it be? and made this one: mtny.mobi

mtny.mobi works as all other tiny url creators, but this has a mobile touch to it.

You can specify if the target url supports mobile when you submit it, and if you are accessing a shortened url by your mobile, you get the option of viewing the page using mowser or go directly to the target link.

Hope this will be useful for someone :)

Tags: ,
Posted in code, stuff |

The under estimated element in xhtml mp

The object element is an extremely powerful element when used in a mobile context. I have made a collection of ways to use it. Her’s an index of some ways to use the element.

Tags: ,
Posted in code, stuff |

Mobile ajax

Mobile Ajax and the so called “mobile web 2.0″ is a hot issue now adays with the iphone and all… I have done some testing just to learn how much ajax one really can expect on current mobile devices.

Hope your device supports ajax now then… The web browser on newer nokias should support most of the examples below. If you have a SE you’ll need a NetFront 3.4 browser which works like a charm!

Nokia just released this document regarding the >Nokia browsers and Ajax.
Please feel free to give feedback.

Tags: , ,
Posted in code, stuff |

gzip test for mobiles

Data cost is known to be one of the main reasons for not using mobile internet. Or that is; the uncertainty of the data cost. So, why not help the user by doing as much as possible to cut the data transfer??

I have made a simple test site to illustrate the importance of this issue:

This is just a quick mock up using php. The test is only zipping the markup and not the style sheet and images on the page. However, it shows huge savings in data transfer!

The next interesting question is if the gain in speed of download is lost in extra processing time on the device…..

Tags: ,
Posted in code, stuff |