This documentation relates to Opera's now deprecated .oex Extension API framework for Opera versions <= 12.15 and also provided by our OEX2NEX shim library.
For the latest Opera Extensions API documentation for Opera versions > 12.15 please consult the latest Opera Extensions API documentation online.
The readonly readyState
attribute exposes the current document readiness of the page within the browser tab.
An HTML or XML file has its current document readiness set to loading
when it is created, and complete
when the file has finished loading. When the value is set by the browser or other user agent, a simple event called readystatechange
is fired on the Document
object.
readonly DOMString readyState // maps to document.readyState
The following example creates a button on the browser toolbar. Then, a new tab is created and given focus. When the tab's page has finished loading, the button's badge turns green.
//
// The background process (e.g. index.html)
//
// Specify the properties of the button before creating it.
var UIItemProperties = {
disabled: false,
title: "Example extension",
icon: "images/icon_18.png",
badge: {
backgroundColor: '#cc0000',
color: '#ffffff',
textContent: '-'
}
};
// Create the button and add it to the toolbar.
var button = opera.contexts.toolbar.createItem( UIItemProperties );
opera.contexts.toolbar.addItem(button);
// Create a new tab and give it focus
var tab = opera.extension.tabs.create({url: 'http://dev.opera.com/', focused: true});
// Start a timed loop
var loop = setInterval(function() {
// When the page has finished loading, turn the badge green
if (tab.readyState === 'complete') {
button.badge.backgroundColor = '#00cc00';
button.badge.textContent = '✓';
// Don't forget to stop the loop
clearInterval(loop);
}
}, 100);