Shorten Intent Example

Applications often have to shorten content. The shorten intent is designed to let users make URL's or content smaller.

Share Intent Registration

<intent
  action="http://webintents.org/shorten"
  type="text/uri-list"
  href="shorten_action.html"
  title="Kinlan's Link Shortener" />

Share Intent invocation

var shareLink = document.getElementById("shortenLink");
attachEventListener(shareLink, "click", function() {
  var url = document.getElementById("url").value;

  var intent = new Intent(
    "http://webintents.org/shorten",
    "text/uri-list",
    url);

  window.navigator.startActivity(intent, intentResponse);

  var intentResponse = function (data) {
    var output = document.getElementById("output");
    setText(output, data);
    focus();
  };
};

Live Demo

Response will appear here: