Open barberousse opened 10 years ago
Previously mentioned in #45, with an MDN page specifically for RSS feeds.
Hey @barberousse and @Zegnat,
I've added some support for this. Right now it will only attempt to register the handler after a new account is created, which means existing customers won't have a chance to enable it.
If you call navigator.registerContentHandler
every time you visit Feedbin, FireFox will show a status bar saying Feedbin is already registered. I'm not seeing a way to detect if a protocol handler has already been registered, which is probably a good privacy feature.
So I'm thinking either:
navigator.registerContentHandler
gets called to avoid calling it againOption 2 might be good because navigator.registerContentHandler
is a little intrusive. It shows a status bar asking if you want to use Feedbin as a handler, so it would be annoying if this showed up after you had already registered Feedbin or dismissed the dialogue. This would be pretty easy to do with option 1 if you cleared your cookies.
What sounds good to you guys?
Mozilla suggests testing for previous registration like this (in Javascript):
var url = "http://starkravingfinkle.org/projects/wph/handler.php?value=%s";
if (!navigator.isProtocolHandlerRegistered("fake", url)) {
navigator.registerProtocolHandler("fake", url, "Fake Protocol");
}
Wouldn't that solve the problem? Is it not possible?
Edit: Sorry, accidentally hit close & comment
@barberousse, I don’t think that will work as it checks for registered protocols. Feed readers are not registered to handle protocols (there is no protocol for a feed, I think) but to handle a certain type of content (registerContentHandler
).
There is a matching isContentHandlerRegistered
method in the HTML Web application APIs spec, though I am not sure about browser support. Bugs: WebKit, Mozilla. Opera used to have it in 12.50, so they may or may not have implemented it in Blink already. But I do not think so.
Maybe something like this should be used, although in my minimum-scale testing no browsers supported it yet:
if ("registerContentHandler" in navigator) {
// Check if the content handler is new to the user before we automatically prompt it:
if ("isContentHandlerRegistered" in navigator &&
navigator.isContentHandlerRegistered("application/vnd.mozilla.maybe.feed", "<%= "#{get_protocol}//#{request.host}" %>/?subscribe=%s") === "new") {
navigator.registerContentHandler("application/vnd.mozilla.maybe.feed", "<%= "#{get_protocol}//#{request.host}" %>/?subscribe=%s", "Feedbin");
}
// Always add a button so users can trigger it themselves:
// …
button.onclick = function(){
navigator.registerContentHandler("application/vnd.mozilla.maybe.feed", "<%= "#{get_protocol}//#{request.host}" %>/?subscribe=%s", "Feedbin");
};
}
(Warning: untested.)
This should be used in addition to the :one_time_content
, as Feedbin should always prompt new users on their first visit. The above code is more of a “coding for a future browser” kind of thing, but should automatically start to work when browsers catch up to the spec.
Ah, I see. I had to manually run the JS because I created my account in Chrome, but then switched to Firefox.
I agree, there are so many circumstances through which a user can 'miss' the opportunity to register - not least "I'm just trying it out, I'll do that later if I like it", which seems a fairly likely reason to dismiss it initially, and then never be shown it again.
Suggestion: somewhere in settings, have an option to 'add to FF as feed reader', which just runs this on click. If it's already working, a user won't click it and won't have the 'already registered' pop-up. Perhaps have it under 'Import/Export'.
Seems like a nice-to-have. Makes it easier to feverishly add subscriptions.. See the MDN page for how-to.