<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://api.webfan.de/api-d/4/js-api/library.js"></script>
<script src="http://webfan.de/cdn/frdl/flow/components/frdl/intent/webintents.js"></script>
</head>
<body>
<b>TestMock service...</b>
<script>
var attachEventListener = function(obj, type, func, capture) {
var objs = obj instanceof Array || obj instanceof NodeList ? obj : [obj];
for(var i in objs) {
if(!!objs[i].addEventListener) {
objs[i].addEventListener(type, func, capture);
}
else if(!!objs[i].attachEvent) {
objs[i].attachEvent("on" + type, func);
}
}
};
/*
console.log('Resolving testIntent: ' + JSON.stringify(intent));
*/
attachEventListener(window, "message", function(ev) {
if(!intent || !ev.origin)return;
// console.log('Resolving testIntent: ' + JSON.stringify(intent));
intent.postResult("Test result from service");
window.opener.focus();
setTimeout(function(){
alert('Resolved testIntent (response was posted back to client): ' + JSON.stringify(intent) + ' EventData: '+ JSON.stringify(ev.data) + ' Event: '+ JSON.stringify(ev));
window.close();
},1000); /*IMPROTANT!*/
}, false);
</script>
<!-- -->
<!--
<intent
action="http://webintents.org/shorten"
type="text/uri-list"
href="http://examples.webintents.org/intents/shorten/shorten_action.html"
title="Kinlan's Link Shortener" />
attachEventListener(window, "load", function() {
var output = document.getElementById("output");
setText(output, intent.data);
intent.postResult("http://kin.ly/A");
}, false);
http://examples.webintents.org/intents/shorten/shorten_action.html
window.navigator.startActivity(new Intent(
"http://webintents.org/shorten",
"text/uri-list",
'http://example.com'),
function (data) {
alert(data);
});
-->
</body>
</html>
|