w3c / web-share-target

Web API proposal for receiving shared data
https://w3c.github.io/web-share-target/
Other
191 stars 20 forks source link

Support for custom protocols in share target #90

Closed JeremyMahieu closed 4 years ago

JeremyMahieu commented 4 years ago

One limitation I'm facing is, imagine a SPA that is connected to a backend with a websocket. This application is intended to run as a single instance. It's in a state that cannot be simply created again in a new instance. When using a share target, it always opens a new instance, which is undesirable in this case.

Expanding the navigational scope of share target action to include custom protocols could be a solution. That way the running instance of the app could perhaps pick up the called share target action.

This is all a bit speculative though, I'm not sure it would actually work or be a good idea.

"share_target": {
  "action": "myapp://mydomain.com/share",
  "method": "GET",
  "params": {
    "title": "title",
    "text": "text",
    "url": "url"
  }
}
JeremyMahieu commented 4 years ago

Or perhaps to not expand the scope too much, just change the protocol:

"share_target": {
  "protocol": "myapp",
  "action": "/share",
  "method": "GET",
  "params": {
    "title": "title",
    "text": "text",
    "url": "url"
  }
}

Results in a call to myapp://mydomain.com/share

mgiuca commented 4 years ago

I think this is out of scope of Web Share Target. There's a feature request for protocol handlers to be registerable from within the manifest.