Getting started with Opera extensions
Introduction
Our Opera 11 Labs release comes with a standards-based framework for running extensions that add extra functionality to the browser. The extensions framework is built on existing standards, with W3C Widgets and JavaScript as the basis. This means that if you can write a web application or widget you already have the skills you need to write extensions. They also make use of HTML5 technology such as cross-document messaging.
For this release, we've prepared quite a bit of reference documentation and tutorials, and there is more on the way. One caveat though: this is an early release of our extensions implementation, and nothing is really stable. This means that you can expect serious changes in the weeks and months to come — adjustments to existing APIs as well as additional functionality. Of course, we'll do our best to keep the documentation as up-to-date as possible. If you have any questions, feel free to ask them on our new Opera extensions development forum.
A peek inside
For a gentle introduction to getting into Opera extensions plus an informative video, read our Come and play with Opera extensions article on Choose Opera. If you want to have a look inside an Opera extension and start playing around with some code, we recommend starting with our introductory What's in an Opera extension? article, and then continuing with the Hello World one, in which you learn how to make a simple extension.
API documentation
Apart from the standard web technologies Opera extensions are built on, there are also a number of unique APIs that come into play. These APIs allow programmers to talk to the browser and control browser functionality such as tabs and windows. We have made our extensions APIs as straightforward as possible, so that developers can pick them up quickly and easily.
Opera extension APIs exist in the opera.extensions namespace. opera.extensions is a global object which most API modules are built upon. For example, if you want to initialize the tabs object, you will write opera.extensions.tabs.
As a starting point, we recommend having a look at the API Documentation overview page, or alternatively, at our handy visual guide to the API docs.
We have also created a few API tutorials to get you started with Opera extensions APIs. They cover User Interface, Tabs, Windows and Messaging.
- Opera extensions: buttons, badges and popups. This article introduces the
ToolbarContext,ToolbarUIItem,ToolbarUIItemProperties,PopupandBadgeobjects. In this API article, you will learn more about creating UI for toolbars, including tooltips, icons and more. - Opera extensions: tabs. This article introduces the
tabsobject and explains how you can manipulate tabs. - Opera extensions: windows. This article introduces the
windowsobject and explains how to manipulate windows. - Opera extensions: Messaging. Coming soon! This article introduces
opera.extensions'postMessagemethod and the onconnect and onmessage handlers. You will learn how to send messages between scripts and popups.
Tutorials
Once you're somewhat familiar with the basic structure and different APIs, it's time to have a look at some hands-on tutorials. We're planning to add more in the weeks and months to come.
- Hands-on tutorial: building an Opera extension: this tutorial shows how to add extra functionality to a page with JavaScript.
- Converting UserJS to Opera extensions: this article teaches you how to convert an existing Opera UserJS into an Opera extension.
Known issues
- Extensions don't work on pages without <script> tag nor on https pages (except if the user explicitly enables it in opera:config).
- Use
opera.postError()to debug the background process. This appears in View > Developer Tools > Error Console, rather than in Opera Dragonfly.
About this article
| Published in | Dev.Opera |
|---|---|
| Date | October 21, 2010 |
| Author | Andreas Bovens |
| Tags | articles, API, opera extensions, download, builds, documentation, extensions |
| Original | Internet Archive |