Widget autodiscovery

Did you know that you can expose your Opera Widgets to your website visitors the same way you expose feeds, using autodiscovery? Didn’t think so, since this is the most underpublished fact about widgets. Anyway, exposing your widget is simple enough: Simply add a relevant link element to your document’s head section:
==

<link
rel="alternate"
type="application/x-opera-widgets"
href="http://my.opera.com/grafio/widgets/get.pl?id=4647"
/>

==
When a page has an attached widget like this, Opera will display a widget icon in the address bar:
!http://virtuelvis.com/download/2006/07/widget-autodiscovery.png (The Widget autodiscovery icon is displayed on the address bar)!
If you want to start using autodiscovery, the value of the rel attribute must be alternate, and the value of the type attribute must be application/x-opera-widgets. Please do not not treat the previous sentence as spec text, because it’s definetly not.
*Update:* Here’s this blog widgetized

6 Comments

  1. underpublished is right! I haven’t heard a thing about that. That’s awesome.

  2. diz

     /  2006-07-17

    But from the look at the headers, it looks like widget is downloading twice.
    Here is the testcase: http://zajec.net/test/widget_autodiscovery
    Here is a http log (feel free to remove it after you see it):
    +++GET 61+++
    GET /grafio/widgets/get.pl?id=4647 HTTP/1.0
    User-Agent: Opera/9.01 (Windows NT 5.1; U; en)
    Host: my.opera.com
    Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
    Accept-Language: pl-PL,pl;q=0.9,en;q=0.8
    Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
    Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
    Connection: keep-alive
    +++RESP 61+++
    HTTP/1.0 302 Found
    Date: Mon, 17 Jul 2006 20:19:22 GMT
    Server: mod-xslt/1.3.8 Apache
    Location: http://my.opera.com/grafio/homes/widgets/artist_s_sketchbook-1_0.zip
    Content-Length: 329
    Content-Type: text/html; charset=iso-8859-1
    +++CLOSE 61+++
    +++GET 62+++
    GET /grafio/homes/widgets/artist_s_sketchbook-1_0.zip HTTP/1.1
    User-Agent: Opera/9.01 (Windows NT 5.1; U; en)
    Host: my.opera.com
    Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
    Accept-Language: pl-PL,pl;q=0.9,en;q=0.8
    Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
    Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
    TE: deflate, gzip, chunked, identity, trailers
    Connection: keep-alive
    +++RESP 62+++
    HTTP/1.1 200 OK
    Date: Mon, 17 Jul 2006 20:19:22 GMT
    Server: Apache
    Last-Modified: Mon, 17 Jul 2006 06:35:28 GMT
    ETag: “33b0243-586bc-3c674c00”
    Accept-Ranges: bytes
    Content-Length: 362172
    Keep-Alive: timeout=15, max=99
    Connection: Keep-Alive
    Content-Type: application/x-opera-widgets
    +++GET 63+++
    GET /grafio/homes/widgets/artist_s_sketchbook-1_0.zip HTTP/1.1
    User-Agent: Opera/9.01 (Windows NT 5.1; U; en)
    Host: my.opera.com
    Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
    Accept-Language: pl-PL,pl;q=0.9,en;q=0.8
    Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
    Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
    Cache-Control: no-cache
    TE: deflate, gzip, chunked, identity, trailers
    Connection: keep-alive
    +++CLOSE 62+++
    Browser reload detected…
    +++RESP 63+++
    HTTP/1.1 200 OK
    Date: Mon, 17 Jul 2006 20:19:23 GMT
    Server: Apache
    Last-Modified: Mon, 17 Jul 2006 06:35:28 GMT
    ETag: “33b0243-586bc-3c674c00”
    Accept-Ranges: bytes
    Content-Length: 362172
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Content-Type: application/x-opera-widgets
    +++CLOSE 63+++

  3. diz

     /  2006-07-17

    Altrough it is not strictly autodiscovery bug as it also happens when downloading directly from widget page: http://widgets.opera.com/widget/4647

  4. But a widget is not the same as a feed. Unless there is only one per page, surely a directory of available widgets is better, listed as normal HTML links? A site will have one or more feeds, but the author could have written hundreds of widgets. I don’t see that they serve the same purpose at all. Widgets work on the desktop. Feeds keep you informed of posts on a site. This is most odd…

  5. exclipy

     /  2006-07-18

    Chris, I think this is best used when the widget is an “alternate” way of receiving the information on the page. eg. if you have a webpage with sport scores, you could make a widget which presented the same sport scores, but in a widget; and thus list it as an alternate link. (Similarly, another alternate link could be the newsfeed for it)
    I don’t think it should be used to say “here are all of the widgets I made over the holidays” on someone’s homepage.

  6. I was also unaware of this feature.
    Added it to my blog now 😀