title: HTTP REFERER is blank for when user agent is switched to mobile devices in Firefox
body: <p>I'm trying to detect users who are coming from Facebook and perform a certain action specifically for those users. </p>
  
  <p>For that, I have the following code:</p>
  
  <pre><code>    if (strpos($_SERVER['HTTP_REFERER'], 'facebook.com') !== false) 
      {
           // FB specific code
      }
  </code></pre>
  
  <p>This code is able to detect traffic that is coming from facebook <em>(and others who fake it, but that's not important for now)</em> for user agents that aren't mobile related, but <code>$_SERVER['HTTP_REFERER']</code> is <code>NULL</code> when the user agent is switched to say and iPhone or Android user agent. </p>
  
  <p>I understand $_SERVER['HTTP_REFERER'] should "<em>not be trusted</em>", but why would it work for one set of user agents and not the other?</p>