Geolocation in Firefox 3.5 and Fennec
I’m excited to introduce a new feature in Firefox 3.5 Beta 4 that I’ve been working on called geolocation. Geolocation is an opt-in tool that lets users share their location information with web sites through Firefox and will enable a new range of services on the web. Geolocation can make web sites smarter and you more productive. Websites that use geolocation will ask where you are in order to bring you more relevant information, or to save you time while searching. Let’s say you’re looking for a pizza restaurant in your area. A website will be able to ask you to share your location so that simply searching for “pizza†will bring you the answers you need…no further information or extra typing required.
This idea isn’t new. We have been researching meshing geolocation data and the web for a few years. Last year, Mozilla Labs released an experimental addon, Geode, which implemented the draft W3C Geolocation Specification. We added support for the spec to Firefox 3.5 and “Fennec” (our mobile browser which is in development) as well as a user interface that put the user in control of which websites could use location. However, we left it to add-ons to implement the code that would actually figure out your location, using any technique (GPS, WiFi or cell tower triangulation, manual address entry) of their choosing. So, with Firefox 3.1, 3.5 or Fennec, plus a third-party add-on, users would be able to use location-enabled websites.
However, we were still left with a chicken-or-egg problem: unless lots and lots of users installed an add-on, websites wouldn’t have a significant audience for which to develop location-enabled services; and without lots of useful web content using the feature, users had no reason to install an add-on.
We decided to investigate bundling a technology that would provide an end-to-end solution, so that the feature would work out of the box for users, and would give websites a large enough potential user base to kick start the development of innovative apps and services. We had learned a lot from the discussions about the various add-ons that had been built, and in other forums over the last few years. Earlier this year, I hosted a talk on Location in Mozilla during which we reviewed many of the critical privacy issues. We boiled these down to some key principles:
* protecting user privacy.
User privacy is super important to us and we believe that we have the best privacy policies regarding your data. The use of the WiFi data, IP addresses, associated protocol bits, should never be used to spy on users, track individuals, or shared without your permission.
* enabling web developers to use the API in an unencumbered way that would work in all browsers that implement the spec
Web developers can use a standard way of accessing geolocation data and not have to worry about the underlying geolocation provider. We don’t share with third-party location provider(s) any information about websites the user’s visiting; this protects both the user’s privacy, and the website’s right to write to a web standard without fear of any third party gaining insight into how the site is being used.
* preserving user choice
This feature is completely opt-in! If you don’t do anything, geolocation is never used. When a web page wants ask you for your location, you get an dialog similar to the one below. If you do nothing, the feature stays off by default. Only if you press “Tell them”, will you send out your location information. Furthermore, users are free to use a different geolocation provider by installing addons.
* applicability to both Firefox and Fennec
To avoid fragmentation on the web, the geolocation feature should be consistent between the desktop and mobile. The truth really is that the line is getting blurred between mobile and desktop. Calling the geolocation feature “mobile only” discounts many use cases that are pretty important.
Given these principles and a strong desire to create an “out of the box” experience in Firefox and Fennec, and to kick start the location aware web, we are happy to announce that Firefox 3.5 and Fennec will be using Google Location Service. We found that we agreed on the many privacy concerns around location. Do check out Mozilla’s privacy policy and Google’s privacy policy. I am pretty excited about these policies I think they are going to be the industry standard when it comes to network based geolocation providers.
Just to provide a bit of technical detail on what exactly is going on, below I will walk through a simple geolocation request.
1) A user goes to a page that has some Javascript that asks for a Geolocation.
2) When the user loads that page, we put up a dialog.
3) If they don’t click anything, or click no, we do not do any geolocation stuff and simply return an error to the requestor.
4) If they click yes, we drop into this bit of code which packages up the WiFi Access Point data into JSON and sends it to Google Location Services over HTTPS. The URL is configurable by preferences (“geo.wifi.uri”). The data sent includes a version number, access token, and an array of public WiFi access points data. The access token basically acts like a two week cookie, and if you clear cookies in the browser, this value is deleted and a new one is used.
6) Lastly, the Google Location service returns a location. It’s another json object that is an actual location.
That’s it. For more information, check out the Frequently Asked Questions. Get ready for Firefox 3.5 and start thinking about how you can location aware your web apps! Here is the spec.
Got questions, feel free to ask. I am looking for feedback. Comments welcome.
Device Orientation
I have a proposal for exposing device orientation in the browser. It is a pretty simple api that allows you to monitor motion changes from Javascript.
For example:
navigator.orientation.watchOrientation(draw);
function draw(o) {
// o.x, o.y, o.z
}
o in function draw is a vector in three dimensional space in meters /
(seconds^2) units.
This allows you to do some revolutionary stuff on the web. This is a simple test web page that moves a ball around a web page. I am just loading this web page directly with XUL Runner on Windows Mobile Professional 6.
This only supports exists on HTC devices but i do expect other devices that have accelerometers to have implementations.
I am tracking this feature in bug 485943. Please check it out and let me know what you think.
windows ce hardware keyboard help
Many devices have both hardware keyboards as well as a software keyboard.
In Fennec, we need to know if we should ask Windows to display the software keyboard when the user clicks in a text box. For example, if the device has a hardware keyboard exposed to the user (in that they see it in front of them), we don’t want to show the software keyboard.
I have tried:
1) HKCU\Software\Microsoft\Shell\HasKeyboard. This value stays the same no matter if the keyboard slide to the open position or not.
2) GetKeyboardStatus(). Same as above
3) Smart Auto-Deploy event. I tried listening for the “_KeyPress” event. That seems to work fine (I know that a key was pressed on the hardware keyboard), but it really doesn’t tell you if the keyboard has been slide closed again.
Anyone know how to do this?
no on the r-word
One thing that always rubs me the wrong way when people use the r-word. It is like walking through a cloud of cigarette smoke as a non-smoker. I clearly do not have the right to ask them to quit, but I would rather not be around it. I have, in the past and only to people that I care about, explain how it isn’t a great thing to say.
Don’t get me wrong, I am not some uptight guy that never swears. The sad truth is before I was involved with the special needs community, I would have never thought twice on how I acted with respect to dropping the r-word. Thinking back, I feel ashamed…
check out this guy who can sum this issue up definitely then me.
tinderbox hg hook
Here is a hg hook to prevent you from pushing changes when the Firefox tinderbox is reporting anything other than success.
create a new file, and paste this into it:
#!/bin/bash
if ! curl -s http://tinderbox.mozilla.org/showbuilds.cgi?tree=Firefox\&quickparse=1 | cut -d '|' -f 4 | grep -v "success"; then
echo "tinderbox is open. pushing...."
exit 0
fi
echo "tinderbox is burning. exiting"
exit 1
Then in your .hgrc file, add a line like:
preoutgoing.hg_tbox_hook = /Users/dougt/builds/hg_tbox_hook
Result my vary. Don’t depend on this to save your butt; check tinderbox often. Note that there is some delay between the time that tinderbox knows that there is a problem, and the time that the “quickparse.txt” file is generated. Hopefully, we can resolve this quickly so that this hook is more useful.
thanks philor for the pro tip. script above now uses the non-static tinderbox quicktest url.
my airmozilla geo talk
hey, i gave a talk about geolocation on air.mozilla. please check it out. You’ll need a Firefox 3.1 nightly or beta releases watch the video.
In the video, I mentioned the strawman position statement and here it is. I am interested in hearing what you think!
Privacy considerations for implementers of the Geolocation API:
User Agents must not send geolocation data to websites without expressed permission of the user. Browsers will acquire permission through a user interface which will include the document origin URI. All permissions should be revocable, and applications should respect revoked permissions.
Some User Agents will have prearranged trust relationship that do not require such user interfaces. For example, Firefox will present a user interface the when example.com performs a geolocation request. However, a voip telephone may not present any user interface when using a geolocation to perform an E911 function.
Privacy considerations for recipients of location information:
The two primary concerns regarding recipients of geolocation data are retention and retransmission. Recipient of location information should retain location information only as long as required. Users must be allowed to update and delete location information that they have posted. Recipient of location information should not retransmit the location information without the user’s consent. Care should be taken when retransmitting and use of HTTPS is encouraged. Furthermore, a clear and accessible privacy policy should be made available to all users that details the usage of location data.
geolocation brown bag
tomorrow at 12:30 pm PT, I am giving a brown bag on Geolocation. It will be broadcasting over air mozilla (http://air.mozilla.com/). If you are interested in geolocation stuff in the browser, please tune in!
"Jailbreaking" your mobile phone
Mozilla has taken a position on “Jailbreaking” your mobile phone.

The letter to the Library of Congress is here (PDF). The main point is that Jailbreaking should not be illegal on personal equipment. It is a short read. If you are reading this, you probably already agree and support Mozilla argument.
A Short History of Mozilla on Windows Mobile
I thought it might be nice to reflect on my involvement in porting the Mozilla to Windows Mobile.
In 2004 we had a project called Minimo — it was meant as a lighter weight build-time configuration of Mozilla for GTK. To showcase the build options, we had an application called TestGtkEmbed that developers could use to test against benchmarks, etc. As the name implies, it was just a testing application — it didn’t have browser features like bookmarks, session history, preference management, etc.
At the end of 2004, I was hired by the Mozilla Foundation working for Chris Hofmann, who was the director of engineering. I started on porting this set of build options to Windows Mobile. At this point, there was no real desire to build an application — I was happy to just continue building a browser engine that could be part of another application.
I really had no desire to do Windows Mobile development. However, at the time, it was really the only devices available that people could by off the street and run very large applications on (think: a modern web browser). The idea was that you could do direct-to-consumer development.
We found that there was some work done by Garrett Blythe (i don’t have a better link, sorry) at Netscape in 2002 which we could leverage — there was a partial patch to NSPR for windows mobile. Garrett was responsible for an effort to port Netscape to Windows CE. His basic approach to porting from Win32 -> WinCE is is what I continued using (and we still use most of it today).
At the beginning of 2005, Brad Lassey started helping and around March 2005 we had much of the platform ported over. Below is the picture of the first time mozilla rendered google windows mobile phone:
If you want to see other pictures, check out rebron’s posts from way back when.
At some point, we needed to branch away from using WinEmbed (basically the same thing as TestGtkEmbed i mentioned above, but for windows) and decided it was a good idea to build a UI for Minimo on Windows Mobile that end users could use. Looking at something we might be able to share between the linux/gtk version of Minimo and Window Mobile, we decided to write the UI in XUL. The size/space measurement for using XUL were very small compared to the flexibility you got (we were thinking extensions).
Working from Brazil, Marcio Galli was basically responsible for the front end. We experimented with a bunch of things like social bookmarking, geolocation, device API, and widgets. We learned alot, and some of this ended up being the basis for a draft spec.
In April 2006, I stopped working on Minimo full time and started other mobile work for Mozilla. The Minimo project continued. I tried to work fix the occasional bug, but development basically ended.
At the end of 2007, I blogged about the end of Minimo (the windows mobile mozilla browser) and a new effort called Fennec. Our team now is much larger than the original effort; we have people in QA, Press, IT, UX, Marketing all thinking about Mobile.

Now, we have our first public milestone release. A completely new font backend, cairo support, extension support, and basically everything that Firefox has.
Today is the rebirth of this browser: Better, stronger, faster. We have a way to go before we declare a “1.0″ release, but hope you come with us and participate in open source, mozilla, and Fennec – our mobile browser.

Milestone 1: Fennec for Windows Mobile
Today we are releasing a pre-alpha version of Fennec for Windows Mobile. This release is pre-alpha. Did I say pre-alpha? Yes, this is pre-alpha and has a way to go in both stability and performance before we release this as “1.0″.
Please try out and give us feedback! Please file bugs at bugzilla.mozilla.org.
Download link:
http://ftp.mozilla.org/pub/mozilla.org/mobile/fennec-0.11.en-US.wince-arm.cab
Brad has instructions here and a great overview:
http://blog.mozilla.com/blassey/2009/02/10/fennec-milestone-release-for-windows-mobile/
Developers:
Get involved. If you are a windows mobile hacker, we would love your help making Fennec better. Find us on irc.mozilla.org #wince.



