Web Share Target on Android: FR: Heuristically split URL field from text |
||
Issue descriptionChrome Version: 64 OS: Android What steps will reproduce the problem? (1) Install https://wicg.github.io/web-share-target/demos/sharetarget.html using Add to Home Screen. (2) Open Google Maps Android app. (3) Open a place. (4) Click "Share With". (5) Choose Web Share Target Test App. (Note: This relies on the Web Share Target feature which is very new and relies on WebAPKs being enabled.) What is the expected result? It says "Text shared: <name and address of the place> / URL shared: https://goo.gl/maps/<id>" What happens instead? It says "Text shared: <name and address of the place> https://goo.gl/maps/<id> / URL shared:" You can also try Sharing directly from Chrome, where the Text field is just a URL, and the URL field is empty. This is because Android intents have no concept of URL, so apps just shove a URL directly into the EXTRA_TEXT intent field. The Web Share Target draft spec allows and encourages implementations to process the incoming data to best fit the title/text/url data structure: https://wicg.github.io/web-share-target/#obtaining-a-sharedata "The user agent MAY employ heuristics to map the data onto the ShareData fields as well as possible. NOTE For example, the host share system may not have a dedicated URL field, but a convention that both plain text and URLs are sometimes transmitted in a "text" field. This is the case on Android. The user agent can check whether all or part of the "text" field is a valid URL string, and if so, move that part of the "text" field to the ShareData's url field." Therefore, the implementation should look in the EXTRA_TEXT field for a regex such as: /^([\S\s]*)\s+(https?:\/\/[^\s]+)$/ and if there is a match, split out the groups into the text and URL fields.
,
Dec 4
,
Dec 13
Issue 914821 has been merged into this issue. |
||
►
Sign in to add a comment |
||
Comment 1 by yfried...@chromium.org
, Dec 14 2017Owner: pkotw...@chromium.org