mercredi 17 août 2016

Should I set the HTTP Referer to my app's URL scheme when navigating out of the app?

My use case is Android but this may apply for any platform / app:

I have some native pages in my app which are identifiable with a URI with a custom URI scheme. For instance myapp:///page14. This is a valid URI and uniquely identifies a page within my app.

This page links to a web page outside of my app. When the user clicks it, Chrome for Android opens and I have the power to set the HTTP Referer field for the target request by adding the meta data Intent.EXTRA_REFERRER_NAME to the Android Intent. The question is: should I?

The HTTP protocol spec says about the Referer field:

This optional header field allows the client to specify, for the server's benefit, the address ( URI ) of the document (or element within the document) from which the URI in the request was obtained.

Is my Android page a "document" in this context? Does the protocol allow it? It's no doubt that passing the URI on could be useful for target sites which does tracking, but I'm unsure if I may run into trouble doing it.

I have noticed at least one web page that blatantly ignores my request if the Referer field contains a non-HTTP-schema. Not sure if it's me or them that's in the wrong.




Aucun commentaire:

Enregistrer un commentaire