-
Notifications
You must be signed in to change notification settings - Fork 547
Intent Scheme
This proposal is a descendant of the App Scheme Spec. It is spiritually connected to Web Intents
Intents are an API for creating interactions between Web apps. They range from opening a page, to editing a photo, to publishing a blog post. They are designed to maximize interactivity with minimal effort by users or developers.
An intent looks like this:
intent:share?type=page&url=https://github.com/beakerbrowser/beaker/wiki/Intent-Scheme
Intents are used like regular URLs, and can be used as the destination of forms.
<a href="intent:view?type=photo&url=dat://.../cat.png">My cat!</a>
Any values POSTed in a form body are added as the parameters to the intent. This enables you to create convenient cross-domain form flows.
<form action="intent:publish" method="POST">
<input type="hidden" name="url" value="dat://.../cat.png">
<input type="text" name="Title">
<button type="submit">Publish</button>
</form>
However, an intent is not usable via Ajax! This is because all intents result in a 302 redirect to the handling application. The handling application is given the parameters, and it displays a "confirm" screen. Upon confirmation, the application handles the action.
todo
todo - installation, and routing of intent URLs to handlers
The concept of intents on the Web has two notable precedents. The first is through informal service implementations, such as Twitter's Web Intents. The second is from a now-dead chrome WebIntents API.
This spec is more in keeping with Twitter's interpretation of Web Intents.
Relationship to the App Scheme Spec
The "Application Scheme" was a naming-system, whereby users could assign dat://
applications to URLs such as app://mail
or app://news
. It was rejected due to the "rampant 404s problem", which was this:
Without coordination, application authors will follow different standards for their URLs. E.g. Despite Bob and Alice having an app://mail
installed, Bob cannot share app://mail/latest
, because Alice's installed app://mail
does not implement that URL. 404s would become a common symptom of that lack of coordination.
The Intents Scheme solves this with two changes:
- URLs are "redirect-based." The URL
intent:share
will redirect to adat://
application using a 3xx code. - URLs are "parameterized." Rather than
intent:mail/user/bob
, it'sintent:mail?user=bob
.
Parameterized URLs include enough information to provide effective fallback behaviors. Multiple apps can be queried for support of the intent-url, and a default application may be included in the url itself.