Examples (informative)
Support in HbbTV
Available since: HbbTV 1.0 (ETSI TS 102 796 V1.1.1, OIPF DAE V1.1)
Locating the Application object
The ApplicationManager class provides the getOwnerApplication() method, which returns the document’s owning application node:
All other application functionality is available from this object.
Creating a new application
Creating a new application is a simple matter of creating a new Application object.
A typical requirement on an application is to only become visible once it has fully loaded. To do this, it can take advantage of load events. Here is an example from a clock application, which wants to load an image to become the background of the clock, upon which it can write the text of the clock.
<script>
function loaded() {
var screen = document.defaultView.screen;
var clock = document.getElementById('clock');
setup_clock( clock.width, clock.height );
// Assumes that the application/oipfApplicationManager object has the ID
// “applicationmanager”
var appMgr = document.getElementById("applicationmanager");
var self = appMgr.getOwnerApplication(Window.document);
self.show();
}
</script>
<style> * { margin: 0cm } </style>
<body onload="loaded()">
<img id="clock" src="clockbackground.png" style="position: absolute;
top: 0px; left=0px">
</body>