Using localtunnel to do web development on actual mobile devices

Surely you’re convinced too now that developing for the mobile web is important. It certainly is for us here at Mozilla. Mobile web development isn’t just about making a ultra-slim stripped down version with no images or Javascript widgets. It’s also about taking regular full powered web applications and making stepwise adjustments to make sure they work responsively on all mobile devices which means everything from tablets to regular cell phones over 3G.

There are numerous good guides such as this for Designing for Mobile Devices and there are great add-ons for Firefox such as the User Agent Switcher. And don’t miss Jason’s wonderful blogs from the archive part 1, part 2, part 3 and part 4. But ultimately, nothing beats actually testing it on a real physical device.

That’s where localtunnel (by Jeff Lindsay) comes in. What it does is that it binds a local port (e.g. port 8000) on your desktop to a real domain name (e.g. xyz123.localtunnel.com) all over SSH. So, you start your local Django server locally and then start a local tunnel and after waiting 1-2 seconds you get a real domain name to type into your iPhone, Android, Nokia smartphone, whatever and you can test away as much as you like.

Granted, you can use it not just for mobile device development but for anything such as telling a colleague over IRC to visit your site running locally on your laptop. And also, if you are in an office where you connect to the same local WiFi with your laptop as you do with your mobile device then you can just use a local IP address. But that’s often not the case especially when working with people in different locations.

An added, yet strange, benefit with using localtunnel to test your mobile device is that it is naturally slow. That’s because the traffic has to go via SSH over the network and your local network won’t be as fast as a real data center. However, in real life, the network connection will be slow when using a mobile device so it’s important to see how your mobile web app behaves with a limited bandwidth.

2 responses

  1. Bjarni R. Einarsson wrote on :

    Hiya! I wanted to point out an alternative project which accomplishes the same thing, PageKite. It is also free-as-in-freedom software. 🙂

    PageKite avoids much of the slowdown you get from using services like this by providing “front-end” servers in multiple geographic locations and it includes zero-configuration SSL support as well, which is nice if you want to be sure your tests are kept strictly confidential or need to test whether an app integrates properly with Facebook or something like that.

    (disclosure: I created PageKite and it is my day job.)

  2. Peter Bengtsson wrote on :

    Thanks Bjarni! Sometimes I think the whole point of blogging is to get alerted about things you haven’t yet discovered. I’ve now played a (tiny) bit with PageKite and it looks really promising. Jeff’s localtunnel has the advantage that is almost stupidly simple meaning it’s easy to get started with. However, as a full-time web developer you often require more features.
    Keep up the good work Bjarni!