The Prism Application Ecosystem
May 11, 2009 – 5:51 amIn a blog post about the recent Prism 1.0 release, Lifehacker expresses confusion about some of the new Prism features:
Mozilla’s caught on to this kind of open-when-needed use, adding built-in support for tray icons (on Windows) or system dock shortcuts (on Macs), along with minimizing the sites to those areas. The other good new things are font control and private data clearing for each window (which was a not-too-small complaint about the previous Prism), and support for notifications and icon updates when you’ve got a new message, chat, or other ping from your web applications (for those sites that support it). I couldn’t quite figure out how to get new mail notifications or icon indicators showing up, but the Prism Features page touts them as present. Anybody want to show us how in the comments?
Like some people’s love lives (if Facebook is to be believed), the answer is: it’s complicated. Adding a tray icon to your application (on Windows) is simple enough. Just set the value of trayicon in the webapp.ini file to true. The application will automatically hide in the tray when you minimize it. Okay, perhaps this wouldn’t pass the “mom test”, but it’s all relative, and making use of many other Prism features is currently less straightforward.
Getting your mail client to display popup notifications when new mails arrive, for example, is more difficult because some knowledge is required of how the web app works. How does Prism know when to display a notification? Either the application has to tell it, or a third-party developer has to use Prism’s customization features to do the same. (If you don’t have at least some notions of and/or interest in software development, you might want to mumble “javascript schmavascript” now and skip to the last paragraph.)
To make the first option possible, Prism defines a new property called platform on the ubiquitous window object found in every web application. Various functions can be called on the window.platform property. (I must admit shamefacedly that the source code browser for Prism is updated only sporadically and is currently a bit out of date, something I hope will be addressed soon.) For example, to display a popup notification you can say:
window.platform.showNotification(
"My notification",
"I'm your app and I just wanted to say hi.",
null
);
Since window.platform is available to web content (as long as the user is running Prism), developers could add statements like this to their apps to make them more Prism friendly. Realistically this is unlikely to happen unless some sort of standardization occurs around this type of API, and browsers that support it become quite popular (both are likely, in my opinion, but not in the short term). In the meantime, a magic file called webapp.js lets you graft code onto an existing web app that adds support for fancy Prism features. (I won’t get into details now since I am planning a tutorial on this topic.)
The bad news is that you need to be a fairly determined and ingenious programmer to get the most out of Prism right now. The good news is that once someone has gone to the trouble of customizing a specific web app, their work can be packaged as a webapp bundle and distributed to other users, much like Firefox extensions. Now that the 1.0 release has given us a robust set of features under the hood, our next task is to foster an ecosystem of webapp bundles for popular web apps, so that end users and not just developers can get the most out of Prism.
9 Responses to “The Prism Application Ecosystem”
I like the posts about prism. Want to use it with google reader, but the popup blocker activates every time I press v to load original article. Know how to get around?
By Greg on May 12, 2009
So, how’s that tutorial coming along then?
By John Leighton on Jul 20, 2009
Been really busy but the tutorial is definitely on my to-do list.
By Matthew Gertner on Jul 28, 2009
The link you provide to the nsIPlatformGlue.idl doesn’t work – same is true on https://developer.mozilla.org/en/Prism/Scripting. I couldn’t find anywhere to leave feedback on MDC so I’m glad I found this.
By Michael Bannister on Aug 11, 2009
Thanks for the heads up, Michael. At some point they changed the MXR links for Prism for some reason. I’ve fixed the links in both places.
By Matthew Gertner on Aug 12, 2009