WebAPI/WebActivities: Difference between revisions

no edit summary
No edit summary
 
(7 intermediate revisions by 5 users not shown)
Line 53: Line 53:
=== Handling an activiy ===
=== Handling an activiy ===


Handling activities will be done trough [https://groups.google.com/group/mozilla.dev.webapi/browse_thread/thread/a3c6e4c31d04b663/ System Message Handler]. An ''ActivityHandlerRequest'' will be passed in the Message.
Handling activities will be done trough [https://groups.google.com/group/mozilla.dev.webapi/browse_thread/thread/a3c6e4c31d04b663/ System Message Handler]. An ''ActivityRequestHandler'' will be passed in the Message.


=== More information about ActivityOptions ===
=== More information about ActivityOptions ===
Line 105: Line 105:
                                               filters: { type: "image/png" }});
                                               filters: { type: "image/png" }});
   r.onerror = function() { alert("failed to register activity"); }
   r.onerror = function() { alert("failed to register activity"); }
Pick a png image and return what the user had picked:
  var r = navigator.registerActivityHandler({ name: "pick", disposition: "inline",
                                              filters: { type: "image/png" }, returnValue: true});
  r.onerror = function() { alert("failed to register activity"); }


View a png/gif image in another page than the current one:
View a png/gif image in another page than the current one:
Line 112: Line 118:
View only HTML pages from example.org:
View only HTML pages from example.org:
   navigator.registerActivityHandler({ name: "view", filters: { url: /https?:\/\/example.org\/.*/ }});
   navigator.registerActivityHandler({ name: "view", filters: { url: /https?:\/\/example.org\/.*/ }});
Open Web Apps can alternatively register in their webapp manifests.


=== Handle an activity request ===
=== Handle an activity request ===
Line 132: Line 140:
     a.postResult({ type: "image/png", url: image });
     a.postResult({ type: "image/png", url: image });
   });
   });
[[Category:Web APIs]]
Confirmed users
1,340

edits