- We design and build extraordinary applications for companies looking to make the next great idea a reality.
- learn more
Using GWT to Write Opera Widgets
I've been experimenting with GWT, seeing how it can be hacked into unusual applications -- bookmarklets, Greasemonkey, widgets -- without breaking. The answer is that there are a number of things about the GWT runtime that break in these scenarios (Each bit of code loads in a different HTML file, so each has its own sandbox, therefore, no cross site action). I'm still looking at ways to make it work, but in the meantime, GWT can be used without any problems to develop Opera widgets.
These widgets, once installed, sit on your desktop, have access to some permanent storage, and can access pretty much any site, so those cross domain Ajax doohickies you wanted to develop? Now there is a way of doing it that doesn't involve proxying through a web server.
I took a crack at developing a little "Hello World!" app, called AnswerWidget. It allows you to enter a search term and then cycles through all of the Yahoo! Answers entries that match that term (up to 50). It refreshes and starts recycling after that.
Now besides discovering that most of the Yahoo! Answers content isn't very good, I also found that writing a widget with GWT couldn't be simpler. Develop your app as you normally would (you may need to drop in a test object that generates content instead of trying to do a cross site JSON request). Once you've compiled into Javascript, just copy your app's html file to index.html and create a config.xml in the base dir that looks something like this:
<?xml version="1.0" encoding="utf-8"?> <widget> <widgetname>AnswerWidget</widgetname> <description> GWT widget for getting Yahoo! answers. </description> <width>495</width> <height>440</height> <author> <name>Dietrich Kappe</name> <link>labs.pathf.com</link> <organization>Pathfinder Associates, LLC</organization> </author> <id> <host>labs.pathf.com</host> <name>AnswerWidget</name> <revised>2007-01</revised> </id> </widget>
Zip it up in a zip file (what else?) so that the index.html and config.xml files are in the base dir, then upload it to your favorite server. If you're using apache, you can create a .htaccess file in the dir where the zip file sits and add the following line:
AddType application/x-opera-widgets .zip
When you download this zip file with Opera, you will be prompted to install it. There is more on deploying Opera widgets here. I wasn't able to get the wdgt extension to work for me, BTW.
If you have Opera installed and feel in a trusting mood, you can install the widget here. Keep in mind that if I was a malicious person, I could mount all sorts of trojan horse attacks inside your firewall. That's one of the downsides to the GWT-based Opera Widget: without the Java source code, you will have a hard time inspecting and validating that the widget isn't malicious.
I do hope the guys at Google work on making the GWT runtime a little bit more flexible. I have some ideas on how to hack it to make it work cross site, but that won't be maintainable in the long run.
Topics: Ajax Widgets, Google, GWT
Leave a comment
About Pathfinder
Recent
- Project Website Part 4: Drag and Drop in jQuery
- The App Store, iPhone, and You
- Multiple Column Sorting with Drag and Drop using Scriptaculous
- Five jQuery plugins that are a joy to use
- Visualizing Your Database Schema Entirely in Rails
- jQuery plugins: Five tips for separating the good from the bad and the ugly
- Resolved: Should schema.rb be included in your source control?
- Flash 10 - FileReference Runtime Access
- Papervision3d 2.0 (Great White) in Flex 3 (Part I)
- MetaWidget - Convention over Configuration UI
Archives
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006


