Page created:
Jun 16, 2009 (? ago)
Last modified ? ago
To main page | Opera Unite HowTo's

Basic HowTo: Simple app (tutorial)

If you are looking for a way to monitor your visitors - any general web counter will do - try StatCounter (just add code to the end of index.html of your service).


How to create a simple application that increments a single variable with Opera Unite and share it with the world:

(Create any folder to hold the files)

1. Create config.xml file:
  <feature name="">
    <param name="type" value="service"/>
    <param name="servicepath" value="test"/>
2. Create index.html file:
var counter = 0;
window.onload = function () {
    webserver =
    if (webserver)    {
        webserver.addEventListener('_index', start_page, false);
        // [1]
function start_page(r) {
    var o = r.connection.response;
    o.write('This page has been seen <b>'+counter+' times</b>!!');
// [1] is a remark -- there you can define additional pages, replacing "_index" with other values, which is final part of URL, i.e.
webserver.addEventListener('other', another_page, false);
will create a page, which will call function another_page(r). "test" is the name of app (defined in config.xml).

By no means this is a complete example. You can expand it, you can replace <script> tag with <script src="script.js"></script> and put your script into scrpit.js and use HTML too.

* Activate Opera Unite if it is not active (Opera will ask about that, if needed)

4. Drag and drop your config.xml into Opera. It will ask whether you want to install this. Confirm by pressing OK.

You're done

Updating app

5. If you modify the index.html file - your page will still show old version. Right-click Opera Unite button, click "Manage Services" (or just press F4 to show/hide left sidebar), right click "Test" service, click "Stop Service", then click "Start Service" - this will reload the source files and reset your counter. Reset function might deal with it, but I'm not sure yet.

To solve the resetting counter problem (if you stop the service or close Opera - all values are reset) - we need to add persistence to script.

See also: Debugging Opera Unite apps

Sharing app

6. To share your Web Apss with others - copy your URL from address bar (F8 - Ctrl+C in Opera) and change it like so:

unite:// -> http://

You can give this address away to your friends.

7. Use Markuper for HTML templating


1. Hiding Web App from dashboard while developing it?


See CRUD and static for more advanced example.

Slava V. [about me]

main page

Last updated

  1. Markuper (HTML templates)
  2. .ua
  3. Opera Unite HowTo's
  4. .us (files)
  5. Distribute Your Application
  6. 24/7 sites (permanent applications - idea) [stub]
  7. Issues
  8. HTTP Connections (AJAX/REST)
  9. Cookies
  10. file_wrap.js - File Wrapper
  11. Basic HowTo: Simple app (tutorial)
  12. Static images, client-side scripts
  13. Application Examples
  14. How to Debug Opera Unite apps
  15. Persistence & databases
  16. Opera Unite benchmark
  17. From PHP to Opera Unite
  18. Uniteness (Framework)
  19. Config.xml
  20. Key-value storage
  21. Widget Object
  22. Notifications (Growl'esque)
  23. Reset (debug)
  24. Cron example
  25. What I meant by CNAMEs
  26. Wish List
  27. Device Unavailable
  28. StopLorem (Opera Unite blogging)
  29. uniteness-0.11
  30. GET/POST data
  31. CRUD And Static (example)
  32. Opera object
  33. URLs
  34. Headers & Redirects
  35. Error Console
  36. JSON State (storing data)
  37. Security
  38. /storage/ (in fileio)
  39. Yusef library
  40. unite_info (a-la php_info)
  41. Javascript Imports
  42. onunload / _close
  43. fileio: Sandboxed Filesystem
  44. Request Hierarchy (like php_info)
  45. Intro: Web Apps with Opera Unite