×
Namespaces

Variants
Actions
(Difference between revisions)

How-to use systeminfo API in WRT widgets

From Nokia Developer Wiki
Jump to: navigation, search
jaaura (Talk | contribs)
vasant21 (Talk | contribs)
(Formatted article, applied code template added description and explanation to api used.)
Line 1: Line 1:
 
[[Category:How To]][[Category:Code Examples]][[Category:Web Runtime (WRT)]][[Category:Code Examples]]
 
[[Category:How To]][[Category:Code Examples]][[Category:Web Runtime (WRT)]][[Category:Code Examples]]
  
Compatibility: '''''Web Runtime in S60 3rd Edition, Feature Pack 2'''''
+
Compatibility: '''''WRT 1.0'''''
  
 
+
== Defining HTML ==
== HTML ==
+
 
To enable system info API in widgets it needs to be embedded in the document since it is implemented as a netscape scriptable plug-in.
 
To enable system info API in widgets it needs to be embedded in the document since it is implemented as a netscape scriptable plug-in.
  
<code>
+
<code javascript>
 
   <embed type="application/x-systeminfo-widget" hidden="yes"></embed>
 
   <embed type="application/x-systeminfo-widget" hidden="yes"></embed>
 
</code>  
 
</code>  
Line 13: Line 12:
 
HTML example
 
HTML example
  
<code>
+
<code javascript>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"  
 
"http://www.w3.org/TR/html4/strict.dtd">
 
"http://www.w3.org/TR/html4/strict.dtd">
Line 27: Line 26:
  
 
== JavaScript ==
 
== JavaScript ==
<code>
+
 
 +
* Lets use the '''[void] sysinfo.beep(Int frequency, Int duration)''' api as an example : It produces a beep tone in a specified frequency for a specified duration.
 +
 
 +
<code javascript>
 
function testapi()  
 
function testapi()  
 +
  // First lets get the reference to the sysinfo object.
 
   var sysinfo = document.embeds[0];
 
   var sysinfo = document.embeds[0];
 +
  //
 
   sysinfo.beep(5000, 900);
 
   sysinfo.beep(5000, 900);
}
+
};
  
 
</code>
 
</code>

Revision as of 23:17, 4 January 2010


Compatibility: WRT 1.0

Defining HTML

To enable system info API in widgets it needs to be embedded in the document since it is implemented as a netscape scriptable plug-in.

  <embed type="application/x-systeminfo-widget" hidden="yes"></embed>

HTML example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript" src="api.js" />
<body onload="testapi()">
<embed type="application/x-systeminfo-widget" hidden="yes"></embed>
</body>
</html>

JavaScript

  • Lets use the [void] sysinfo.beep(Int frequency, Int duration) api as an example : It produces a beep tone in a specified frequency for a specified duration.
function testapi() 
// First lets get the reference to the sysinfo object.
var sysinfo = document.embeds[0];
//
sysinfo.beep(5000, 900);
};
111 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×