Open nicksherman opened 1 year ago
I assumed this would not be possible because I thought that the XML file would be loaded and rendered with native code outside the realm of app extensions. But it looks like, at least in modern versions of WebKit/Safari, the XML content is rendered by loading a special document with associated JS code to render the XML as regular HTML. This leaves open the possibility that the Subscribe to Feed extension could at least detect that the content being loaded is likely to be an XML rendering, and then attempt to parse the rendered content to see if it looks like an RSS file. In that case it would infer that the document.location.href
for the loaded page is in fact itself an RSS feed, and enable the extension's action button to operate as usual with that URL as the target.
Weird. Safari usually prompts you to open a link in your default RSS reader in this scenario. I wonder why it isn't recognizing the RSS feed.
Might not have a default RSS reader set.
I am able to reproduce the issue and I have NetNewsWire set as my default reader I think it must be a discrepancy in Safari behavior based on what the server advertises the content-type as. If you run:
curl -I https://screenrant.com/feed/movie-news/
You'll see it returns headers with a content-type of "text/xml". Whereas when I copy the same file to my own (Apache-based) server, it returns the type as "application/xml".
Hmm, nope. I changed my server to set the MIME type to text/xml and it still works from my server.
Ah, weird. It's the presence of a header:
x-content-type-options: nosniff
That I guess prevents Safari from knowing what kind of data it is? Though I guess it figures it out since it ends up rendering it as an XML after all.
(Posting this here on request of Daniel over in the NNW Slack workspace.)
It'd be great if NNW's feed detection for the "Subscribe to Feed" button in Safari could check if the current URL is itself an RSS feed. Sometimes I land on a URL for a feed (e.g. this Screenrant feed and it'd be handy to be able to click the Subscribe to Feed button right from Safari instead of copying the URL, opening NNW, and adding a new feed there manually.