Open jinnko opened 9 years ago
Hmm so this is problematic because due to the security constraints of Sandstorm, a grain doesn't actually know its own grainId/URL.
2 possible solutions here:
Pinging @kentonv to see which is more reasonable. Option 2 seems like the wrong way to go, but is certainly easier to get working.
So reading https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerContentHandler leads me to believe that option 2 may not even work. Each session to a grain is hosted on a random subdomain, and the note says "Web sites may only register content handlers for themselves". I'm not sure if subdomains are allowed to registerContentHandler with a url pointing to a parent domain or not.
Yeah, it seems like this would need to be another postMessage API mediated through the shell.
Could the URL be constructed in javascript on the client side rather than on the server side? I guess you'd then be able to use document.location
or some such. (it's been a long time since i've done js dev, so please excuse any ignorance).
@jinnko Afraid not. The app is in an iframe where it does not have access to the top-level document.location.
registerContentHandler has been removed from Firefox.
https://www.fxsitecompat.com/en-CA/docs/2018/navigator-registercontenthandler-has-been-removed/ https://bugzilla.mozilla.org/show_bug.cgi?id=1398169
TT-RSS has a feature in Preferences>Feeds>Firefox integration to add it as a feed reader, allowing one to easily add RSS subscriptions to the TT-RSS instance. Unfortunately this doesn't work as expected within Sandstorm.
I found it's possible to make this work manually using the Inspect Element>Console feature. I took the code off the "Click here to register this site as a feed reader" button and modified it to contain the correct URL, then ran this via the Console.
The code in the page reads as follows:
Replacing the localhost then running the code in the Console achieves the desired result:
Note that editing the code inline then re-pressing the button doesn't work. I don't know why.
As there's no other easy way to register an RSS reader I expect this feature within TT-RSS to work.