Ask away

Referrer data exists but is always empty

Kevin 05/18/17 14:59


Question CategoryGeneral,Configuration,Component,Properties

Number of completed projects0

Question StatusUnsolved

  • referrer
  • nest component
  • configuration


I am working on an iOS application on iOS 10. document.referrer seems to always be empty. I have tried to check if it exists by using the wrapping code: if( 'referrer' in document ) { alert('referrer ' + document.referrer); } and it throws an alert, but the value is always empty, whether I am accessing it from another page or if I am accessing the page for the first time. I have also included the meta tag: <meta name="referrer" content="always"> How do I get the value of document.referrer? I am using the NEST IDE and my JS components.


George 05/22/17 11:29

How are you accessing your page? The referrer is always empty if you access the page directly, i.e., not through a link.

Bill 05/23/17 21:47

How exactly is your web app accessing pages? Are they hosted from a server? Bundled with your application? If the latter, you're not going to get a Referer header, as described above.

Terron 05/24/17 01:32

Since we don't know anything about your native wrapper, it's possible there are a couple of things going on: 1. document.referrer is derived from the HTTP header Referer (note historical misspelling). It's possible that something in your iOS code is setting or suppressing that HTTP header. 2. If your web app is hosted using URLs with file schema (as in file:///foo.html), browser engines will not set the HTTP Referer header to prevent leakage of sensitive information. (You wouldn't want to send local filenames to a remote webserver if, for example, you had a local webpage that linked out to a remote site.)