[Warning: this post suggests stuff that may not work now, or may break in the future. Use at your own risk!]
I’m really happy to hear that, as the official google blog points out, Gmail now has support for Google Gears allowing you to view your mail offline.
This has caused quite a stir in the blogging community – TechCrunch invites you to throw off your chains, GoogleWatch speculates that it might be the tipping point for Gears adoption, Colin Charles mentioning SSBs such as Fluid and Prism (which this article is about), Google Operating System giving a basic overview and also the GadgetWise NYT blog giving it a spread.
So far, so good. Now what if we want to use a Site Specific Browser, such as those created by Fluid and Mozilla Prism? These “SSBs” are essentially entire browsers, but used only for a single web app – which is quite handy really. I think that Google’s paradigm of basically making each tab / window in your browser it’s own application instance may well remove the need for things like this eventually, but for the time being it would be great to use Gmail’s new offline capability in an SSB.
Well – we can’t do much about enabling Gears in Fluid, since it’s based on WebKit. Check back if you here that Google releases some frm of plugin for WebKit (although actually WK already has HTML5 style “local storage” using SQLite so it could be native support).
We can however do some hacking to get Gears installed in a Prism browser, so let’s go through the process. By the way – I am using Mac OS X 10.5, but I think this should work for any platform that can get Firefox and Google Gears.
I’m using a Google Apps For Your Domain account, it’s worked fine there, although your account will have to have Offline access enabled by google (patience, young grasshopper!).
Step 1: Split a Beam
Go and install Mozilla Prism. I did this by installing it as an extension to my current Firefox.
Once it’s installed and you have restarted the browser, login to your Gmail and from the Tools menu choose “Convert Website To Application.”
Choose whatever options you like in terms of where to put the shortcut. Personally I grabbed Chris Ivarson’s awesome Fluid Gmail Icons and used Preview.app to convert the 128×128 version into a PNG file.
I *also* had a slight issue with not being able to create the app inside the Applications folder, because it needed to Authenticate but just failed silently – YMMV.
Assuming that’s done you should have a nice new Gmail SSB, which you can start and log in to Gmail with. Funky.
Step 2: Start The Fans, Please!
[Note: you have to be older than young, from the UK and to know who Richard O'Brien is to get that "start the fans" bit]
So now we need to get Google Gears installed. You can try doing this from Gmail’s own interface but it will fail complaining that “Gears is not compatiable with XYZ” (where XYZ is the name you gave it and a version number). This is because, even though your Gmail webapp *is( Firefox under the hood, it doesn’t report itself as such to the extension. What we need to do is convince the extension that it is in fact compatible with it.
[Note: it might be more efficient if you want to install several extensions to make your SSB report itself as really being Firefox, but I'm happy with a one-at-a-time approach].
The next thing to do is actually download Google Gears manually. I suggest that you really do try (and fail) to install it from inside the Prism app, because you will be told the current, valid URL for the XPI in the process. If you’re super lazy, here’s where I got mine from (not a link so that you’re encouraged to FIND THE RIGHT URL FOR YOURSELF!):
http://dl.google.com/gears/current/gears-osx-opt.xpi
You might want to use Safari / Opera / wget / IE to actually download it.
Step 3: Unpack, Tweak, Repack
An XPI file is in fact just a ZIP file with delusions of grandeur. Rename the file to “gears-osx-opt.zip” and unpack it.
Now open up “install.rdf” and find the bit that looks like this:
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.5</em:minVersion>
<em:maxVersion>3.0.*</em:maxVersion>
</Description>
</em:targetApplication>
The big long string in curly brackets is the Firefox GUID. We will need to change this, and also the version numbers.
I found the GUID and version numbers inside my (OS X-specific) “Gmail.app” that Prism created. Control+Click on it and choose “Show Package Contents” then navigate to “Contents/Resources/application.ini” and open this in a text editor. It is the “Version” and “ID” values that you want from the “[App]” section.
Applying these to the original install.rdf file we get this (I’ve extended the version numbers just for the hell of it):
<em:targetApplication>
<Description>
<em:id>prism@developer.mozilla.org</em:id>
<em:minVersion>0.1.*</em:minVersion>
<em:maxVersion>10.0.*</em:maxVersion>
</Description>
</em:targetApplication>
Save the edited “install.rdf” file and now you need to repack the zip / xpi. Take note – you should compress the *files* and not the *directory* or it won’t work.
Change your newly created zip file’s extension back to XPI – and we’re ready to install!
Step 4: Install
This may vary across platforms, I’m not sure.
From the *status bar* (an unusual place to get to the Add Ons / Extensions list) of your Prism app, click the cog and choose “Tools”, “Addons”. This should pop open the Add Ons panel.
Drag and drop the XPI onto the Add Ons panel and, hopefully, bingo!
If you get an error about “version support” then you might have got the ID or version number wrong somewhere. If you get one about “cannot find install script” then your XPI / zip is badly formed. Leave a comment if you need more help here.
Step 5: Enable Gears for Gmail
You’ll need to restart your browser and log back in to GMail. Then you should be able to click the “Offline” icon at the top of the interface and go through the normal Gears “I trust this application” process.
That’s it! You should now be able to access your mail offline. It’s worth noting that the shortcut that gears can create for you to open your email while offline seems to work fine too.
[Update 31st Jan 2009: It looks like Fluid may support Gears sometime soon!]
cunningham
Excellent! Clear, easy and working instructions for something that has eluded me for a few weeks.Thank you so much.
Chris Lord
Hi,
I was very excited to see these instructions but when I tried to replicate, Prism did not allow me to drag the xpi onto the addons window. No errors or anything…
I am using Prism 1 on Mac 10.5.7
Cheers,
Chris
pete
Try running Console.app, which may give you some more error / debug info as to what it going wrong. Failing that … I’m afraid I’m out of ideas!
Pepa
Hi, it doesn’t work for me with Prism 1.0b1. When I launch the addon installation, I get an error “could not install… installer script not found – 204″. Any hints what’s wrong? Thanx very much
pete
Hi Pepa,
as I mentioned in the post – your XPI / Zip file is probably badly formed. You should make sure that it’s in exactly the same format as the original one (with the same internal paths).
If I get the chance I’ll post some more info on it, but since my wife had a baby recently don’t hold your breath!
Good luck,
Pete
neil
Many thanks! I didn’t think I’d be able to use Prism for Gmail (I’m on a PC btw), as I hate the standard interface and use Google Redesigned add-on for FF. I used this hack and voila…it works!
Thanks again!!
Chris Lord
Aha!!! 1 other thing is that ZIP may append a .zip extension in the name & extension section of Get Info even if you can’t see anything when looking at the file normally.
Up and runnning now – of course you have to redo this every time gears updates…
Wes
The latest version of Gears, 0.5.30.0, contains its own loader stub that detects which release of Firefox you’re using and then chooses the appropriate module. (At least, that’s what it does on OS X.) This fails when it gets Prism’s version number (eg, 1.0) instead of the 3.0 or 3.5 that it expects.
The workaround is simple enough, although a bit of an ugly hack: http://westacular.livejournal.com/43666.html
wanas
I have tried this with greactions addon for google reader, its installed successfully but the addon didnt work :(.
when I open tools > addons I found it loaded
is there any suggestions ?
anon
not sure about the motivation here. since gears supports firefox anyway, why bother with prism?
I was hoping to get this working with Prism 0.8 or above, rather than within firefox. there I can see the logic.
Olivier
I made a gears xpi for prism 1.0b2 on top of firefox 3.5 for linux based on your article and Wes’ further fix.
It simplifies the install for people lazy like me.
For those interested, you can grab it here: http://www.bottomlesspit.org/2009/12/14/gmail-offline-with-prism-on-linux
matt
Hi. This sounded perfect. However, I had a go, and am running into problems.
I have successfully installed Gears (woohoo!), and can see it in the extensions section of the addons window in my prism app.
However, GMail still insists on trying ot download Gears and won’t recognise that it’s already installed.
I have to turn offline mode on through a menu item in the settings. Once I enable and save, it goes through the normal download process, so of course I still get stuck at the bit that says it won’t install (even though I already did it).
I am using Prism on a Mac running Snow Leapoard (10.6.4)
Any ideas? This would be really handy for me.