indie-configThis article is a stub. You can help the IndieWebCamp wiki by expanding it.
indie-config was introduced, discussed, prototyped, and demonstrated at IndieWebCampUK 2014 WhyBy setting up indie-config on your personal site, you can then click on web action links or buttons on others sites (e.g. "Reply", "Favorite" etc.) and have those actions automatically activate your site's posting interface to. By adding loading indie-config to your post permalinks (and anywhere else you have webactions), you empower indieweb users that have indie-config setup on their sites to quickly like, repost, and reply to your posts using their own site! Indie-config is the first working prototype of how a browser can be aware of the tools you want to use to perform actions on the web. As use-cases gets proven and flows mature it hopefully gets superseded by better suited methods built right into the browsers themselves. How to publishHow to setup indie-config on your personal site: Create the configuration pageCreate a page on your site that only you will need to access. This might be a page such as "config.html". This page should contain the following Javascript:
<script>
(function() {
if (window.parent !== window) {
window.parent.postMessage(JSON.stringify({
// The endpoint you use to write replies
reply: 'https://aaronparecki.com/note.php?reply_to={url}'
}), '*');
}
}());
</script>
Replace the URL above with the URL to your own posting interface.
Register the web action protocolOn your home page, find somewhere to add this code to be displayed only to you when you are signed in to your own site.
<script>
window.navigator.registerProtocolHandler('web+action', 'https://aaronparecki.com/config.html?handler=%s', 'Aaron Parecki');
</script>
Note that you will want to replace the URLs (
Turn it onNow when you visit your home page, you will see a prompt asking whether your site should be allowed to handle "web+action://" links.
Click "Add Application" (or the equivalent for your browser) and your website is now registered in your browser or operating system.
ExampleHow to consumeYou need an indie-config loader, like indieconfig.js, and a webactions shim, like webaction.js. You then load them both in the head of your site: <script type="text/javascript" src="/path/to/indieconfig.js"></script> <script type="text/javascript" src="/path/to/webaction.js"></script> And then everything is done! You might want to add some styling on the The example scripts linked to above, from Pelle's blog http://voxpelli.com/, loads the indie-config on the first webactions interaction after the page has loaded and uses a 3 second timeout before it gives up and fallbacks to redirecting to the
FAQOk to registerProtocol handler every timeQ: Is it ok to run that register protocol thing every time I load my home page? A: Yes it is ok. If you run the registerProtocolHandler() on the same page that's already registered nothing will happen – it will know that everything is registered as it should. Using custom handler for replies instead of configurationQ: Why does the custom handler send back configuration information instead of just handling replies directly? (i.e., web+action://permalink would be handled by with http://example.com/reply?u=permalink) A: This does not provide a fallback if there is no handler registered. There would be a <a href="web+action://permalink">Reply</a> link on the page that would go nowhere isProtocolHandlerRegisteredQ: Couldn't you use isProtocolHandlerRegistered to check if a handler is registered, and only use the custom protocol if it is? A: That function doesn't exist! And it would be a potential privacy leak, e.g., allowing sites to see which apps you have installed on your phone by checking facebook:, twitter:, etc.. IndieWeb ExamplesPelle WessmanPelle publishes JavaScript on http://voxpelli.com that queries a user's registered web+action handler the first time an indie-action is clicked. If an appropriate action handler is found, his "Reply" and "Post" links will use it instead of the default.
Barnaby WaltersCollaborated with Pelle at IndieWebCamp UK 2014 where they demonstrated links on voxpelli.com directing to a reply link on waterpigs.co.uk. Barnaby has a static page on his site for registering a web+action handler: https://waterpigs.co.uk/indie-config.html Kyle Mahan
Malcolm Blaney
BrainstormingReturn RouteIt would be nice to have an extra argument for a URL to return to after the action has been completed. This way we can complete everything in one window. No pop-up required. Status OptionMalcolm added a status option to his implementation on 2015-10-22. The idea is that indie-config can perform a request back to the user's site via CORS, which will return the state of the target. It should provide the state of all actions known to the user's site for that user and target url combination. It should provide the state as JSON, ie { "like": true, "follow": true } or some other combination. It can omit false values as that is implied. When the calling site receives this information, it can mark up the display of each action however it likes. This could just be adding a class name like "highlight" to the action, or changing the text of a link from "follow" to "following".
See Also |



















