New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 789379 link

Starred by 4 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Feature



Sign in to add a comment

Web Share Target on Android: FR: Heuristically split URL field from text

Project Member Reported by mgiuca@chromium.org, Nov 29 2017

Issue description

Chrome 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.
 
Cc: ranj@chromium.org
Owner: pkotw...@chromium.org
Cc: ericwilligers@chromium.org
 Issue 914821  has been merged into this issue.

Sign in to add a comment