Closed Bug 996039 Opened 11 years ago Closed 7 years ago

[User Story] Hyperlink to a page in an app

Categories

(Firefox OS Graveyard :: Gaia::System, defect)

defect
Not set
normal

Tracking

(tracking-b2g:backlog)

RESOLVED WONTFIX
tracking-b2g backlog

People

(Reporter: benfrancis, Unassigned)

References

Details

(Keywords: feature, Whiteboard: [ucid:System207])

User Story

As a web developer, I want to hyperlink to a particular page of a web app so that I can direct a user to a specific location within an app instead of forcing a browser tab to be used. (which does not have the proper app permissions)

Acceptance Criteria:
1. A user clicks a hyperlink to within a specific app (eg. app://search.gaiamobile.org/search.html) and is directed to that location within the app associated with that url.
2. Now within the app from AC1, the app has the permissions defined by its manifest.
As a web developer, I want to hyperlink to a particular page of a web app. Currently you can't really do this in Firefox OS which is a shame because hyperlinks are what make the web the web. The reason you can't do it is that hyperlinking to a URL inside an app from a browser tab or another app will open that URL in a browser tab, but browser tabs don't have the mozapp attribute set to the manifestURL of the app, which means none of the permissions the app has can be used. What we need is a way to determine for a given URL whether it corresponds to a particular app and to open that URL in the app instead of instead of in a browser tab. I started a thread on the mailing list on this topic entitled "What defines the scope of an app?". The conclusion seems to be that by default the scope of an app is the origin of the manifest URL, but that in future we may want to carve this up further with a "scope" attribute in the app manifest to allow for multiple apps from one origin, or a mix of and non-app content on one origin. So a good starting point might be that when we load a URL, we check it against a list of installed origins and if it corresponds to an installed origin then we open the URL in that app, rather than in a browser tab. This is a complement to bug 972320 which does the reverse, by proposing loading URLs outside of the origin of the current app outside of the app. Being able to link directly to a page inside an app rather than always just launch it at a fixed start path opens up all sorts of possibilities, like being able to add a contact to the homescreen by bookmarking its URL inside the contacts app for example. Another use case might be the browser icon on the homescreen for the system browser which we'd potentially like to be a bookmark to app://search.gaiamobile.org/search.html
blocking-b2g: --- → backlog
User Story: (updated)
Whiteboard: [ucid:System207]
Could the same effect be achieved using Activities? (Albeit with more effort needed than just writing a hyperlink) Or would this feature give us something more/different?
No existing web activity would do this, a view URL web activity will always try to open a URL in the browser app which for URLs to apps with certain permissions may not work as expected. The only way I can think to achieve this with web activities is if an app registered to handle the view URL web activity, with a pattern which matches all of the URLs inside that app: "activities": { "view": { "filters": { "type": "url", "url": { "required":true, "pattern":"<pattern matching app URLs>", "patternFlags":"i" } } }, ...and every app which linked to it fired a view URL web activity in order to link inside the app. But that would require every app on the web to add this to their manifest and for every app which wished to link to it to use a web activity instead of a hyperlink, which would be insane. Something as basic as hyperlinking from one web page to another should not be this hard, it's what makes the web the web. That's why I think a better approach would be that by default all URLs at the origin of an installed app should open in that app rather than in a browser tab, and if that app needs to define its scope in a more granular way then it uses a scope property in the app manifest (see the proposal here https://github.com/w3c/manifest/issues/114#issuecomment-46219479). Nothing special is required on the part of an app linking to a URL within this scope, they just use an ordinary hyperlink.
Blocks: 1038833
Hi Ben, > Another use case might be the browser icon on the homescreen for the system browser which we'd > potentially like to be a bookmark to app://search.gaiamobile.org/search.html May I confirm with you for what I understand for this feature is correct or not? Q1: If a web page has a hyperlink with app://email.gaiamobile.org/index.html, then FxOS device will open email app because at least this URL matches to the origin of manifest of email app. Is this correct? Q2: It implicitly means the app protocol become a identifier of a specific app which can be used outside of device installed this app. How about privileged app who didn't mention origin in it's manifest? In this case it'a URL of app schema will be app://uuid/index.html. Then the identifier outside the device will become non-unified. Q3: Does Firefox OS admit that app protocol will be used (at least) as Mozilla standard which can point into resources of application? Thanks.
Flags: needinfo?(bfrancis)
(In reply to Marco Chen [:mchen] from comment #3) > > Another use case might be the browser icon on the homescreen for the system browser which we'd > > potentially like to be a bookmark to app://search.gaiamobile.org/search.html We're actually not doing that any more. The browser icon will probably just be an app icon for the search app and the launch_url will be /new_tab.html See bug 1041620. > May I confirm with you for what I understand for this feature is correct or > not? > > Q1: > If a web page has a hyperlink with app://email.gaiamobile.org/index.html, > then FxOS device will open email app because at least this URL matches to > the origin of manifest of email app. Is this correct? I'm actually not sure how app scope will work with packaged apps, it is much more useful for hosted apps which have a real URL on the Internet. If we implement app scope to include packaged apps then yes, I would expect it to work this way. But hyperlinking to an app:// URL from a web page when it may or may not exist on any given device seems of limited use. One potential use case is being able to bookmark an app:// URL to the homescreen, e.g. to bookmark a particular contact in the contacts app. But most of Gaia's packaged apps are implemented as single page apps with only one URL so this is of limited use at the moment. > Q2: > It implicitly means the app protocol become a identifier of a specific app > which can be used outside of device installed this app. Theoretically, yes. Although the latest working draft of the W3C's "The app: URL Scheme" specification [1] describes app:// URLs as being sandboxed to a given app and they will not work outside the app. I'm not sure what direction we want to take that in. > How about privileged app who didn't mention origin in it's manifest? In this > case it'a URL of app schema will be app://uuid/index.html. Then the > identifier outside the device will become non-unified. app:// URLs which use a randomly generated UUID as an origin are of particularly limited use outside of the app. > Q3: > Does Firefox OS admit that app protocol will be used (at least) as Mozilla > standard which can point into resources of application? the app:// protocol is currently a proprietary Mozilla protocol which imitates HTTP but which does not reference real URLs on the Internet. There are attempts to standardise this for packaged apps [1] but I personally expect the current packaged Open Web Apps to eventually be superseded by a new offline solution using ServiceWorkers and possibly standardised hosted packages [2] with real URLs on the Internet. The concept of "app scope" is much more useful for hosted apps so that we can define a subset of an origin as being the scope of an app and open hyperlinks to http:// URLs in their corresponding app. With packaged apps its much more obvious that anything inside the package is part of the app so app scope is of limited value. 1. http://www.w3.org/TR/2014/WD-app-uri-20140529/ 2. http://w3ctag.github.io/packaging-on-the-web/
Flags: needinfo?(bfrancis)
blocking-b2g: backlog → ---
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.