title: what is the trick Facebook uses to inject its icon onto a linked page?
body: <p>when A posts a link on Facebook, and then B clicks that link in Chrome (not in Firefox, and haven't tested others), B sees the Facebook white "f" on blue background icon (favicon.ico) shown on the tab of the linked page. sometimes, presumably when the page has its own favicon, refreshing that tab will replace the icon with the correct one; but most often the Facebook favicon remains. at first I believed Facebook was using frames in some tricky way, but using View Source, that appears not to be the case. how would one program an href or redirect in such a way as to preload one's own favicon onto a linked page as Facebook does?</p>
  
  <p><img src="https://i.stack.imgur.com/bjnjH.jpg" alt="(screenshot)"></p>
  
  <p>here's what I've tried without success, my icon gets replaced with nothing (and only shows in both the tab and navbar in Firefox, only in the tab in Chromium, but that's beside the point):</p>
  
  <p><a href="http://unixshell.jcomeau.com/tmp/linktest/index.html" rel="nofollow noreferrer">http://unixshell.jcomeau.com/tmp/linktest/index.html</a></p>
  
  <pre><code>jcomeau@unixshell:~/www/www/tmp/linktest$ cat index.html
  &lt;html&gt;
  &lt;head&gt;
  &lt;link rel="shortcut icon" href="favicon.ico" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;a href="redirect.html?url=http://homesteadingsurvivalism.myshopify.com/"&gt;homesteadingsurvivalism.myshopify.com&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  jcomeau@unixshell:~/www/www/tmp/linktest$ cat redirect.html 
  &lt;html&gt;
  &lt;head&gt;
  &lt;link rel="shortcut icon" href="favicon.ico" /&gt;
  &lt;script language="javascript" type="text/javascript"&gt;
  var newpage = window.location.search.substring(5);
  window.setTimeout('window.location = newpage; ', 3000);
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;p&gt;Redirecting to selected site, please wait...&lt;/p&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>after Yan's comment I also tried with no success redirect.cgi:</p>
  
  <pre><code>jcomeau@unixshell:~/www/www/tmp/linktest$ cat redirect.cgi; QUERY_STRING=url=http://this.is.a.test/ ./redirect.cgi 
  #!/bin/bash
  echo -ne "Content-type: text/html\r\n"
  echo -ne "Location: ${QUERY_STRING:4}\r\n"
  echo -ne "\r\n"
  cat &lt;&lt;-EOF
      &lt;html&gt;
      &lt;head&gt;
      &lt;link rel="shortcut icon" href="favicon.ico" /&gt;
      &lt;/head&gt;
      &lt;body&gt;
      Redirecting to ${QUERY_STRING:4}
      &lt;/body&gt;
      &lt;/html&gt;
      EOF
  Content-type: text/html
  Location: http://this.is.a.test/
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;link rel="shortcut icon" href="favicon.ico" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  Redirecting to http://this.is.a.test/
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>