{"id":3113,"date":"2015-11-05T14:37:36","date_gmt":"2015-11-05T03:37:36","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=3113"},"modified":"2015-11-05T14:37:36","modified_gmt":"2015-11-05T03:37:36","slug":"moz-icon-a-curious-corner-of-firefox","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2015\/11\/05\/moz-icon-a-curious-corner-of-firefox\/","title":{"rendered":"moz-icon: a curious corner of Firefox"},"content":{"rendered":"<p>Here&#8217;s an odd little feature in Firefox. Enter the following text into the address bar.<\/p>\n<pre> moz-icon:\/\/.pdf?size=128<\/pre>\n<p>On my Linux box, it shows the following icon image.<\/p>\n<p><a href=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/pdf-icon-linux.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-3114 size-full\" src=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/pdf-icon-linux.png\" alt=\"pdf-icon-linux\" width=\"138\" height=\"137\" \/><\/a><\/p>\n<p>On my Windows laptop, it shows a different icon image.<\/p>\n<p><a href=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/pdf-icon-windows.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3115\" src=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/pdf-icon-windows.png\" alt=\"pdf-icon-windows\" width=\"147\" height=\"151\" \/><\/a><\/p>\n<p>On my Mac Laptop, that URL doesn&#8217;t work but if I change the &#8220;128&#8221; to &#8220;64&#8221; it shows this icon image.<\/p>\n<p><a href=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/pdf-icon-mac.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-3116\" src=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/pdf-icon-mac.png\" alt=\"pdf-icon-mac\" width=\"157\" height=\"149\" srcset=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/pdf-icon-mac.png 314w, https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/pdf-icon-mac-252x239.png 252w\" sizes=\"(max-width: 157px) 100vw, 157px\" \/><\/a><\/p>\n<p>In each case we get the operating system&#8217;s icon for a PDF file.<\/p>\n<p>Change the &#8220;size&#8221; (up to a maximum of 255) value and you&#8217;ll get a different size. Except on Mac the limit seems to be lower, probably due to the retina screen in some way.<\/p>\n<p>Change the file extension and you&#8217;ll get a different icon. You can try all sorts, like &#8220;.xml&#8221;, &#8220;.cpp&#8221;, &#8220;.js&#8221;, &#8220;.py&#8221;, &#8220;.doc&#8221;, etc.<\/p>\n<p>How interesting. So what&#8217;s this for? As far as I understand, it&#8217;s used to make local directory listing pages look nice. E.g. on my Linux box if I type &#8220;file:\/\/\/home\/njn\/&#8221; into the address bar I get a listing of my home directory, part of which looks like the following.<\/p>\n<p><a href=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/home-directory-listing.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3117\" src=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/home-directory-listing.png\" alt=\"home-directory-listing\" width=\"476\" height=\"288\" srcset=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/home-directory-listing.png 476w, https:\/\/blog.mozilla.org\/nnethercote\/files\/2015\/11\/home-directory-listing-252x152.png 252w\" sizes=\"(max-width: 476px) 100vw, 476px\" \/><\/a><\/p>\n<p>That listing uses this mechanism to show the appropriate system icon for each file type.<\/p>\n<p>Furthermore, this feature is usable from regular web pages! Just put a &#8220;moz-icon&#8221; URL into an &lt;image&gt; tag and you&#8217;ll get OS-specific icons in your webpage.<\/p>\n<p>That&#8217;ll only work on Firefox, though. Chrome actually has a similar mechanism, though it&#8217;s not usable from regular web pages. (For more detail &#8212; <em>much<\/em> more &#8212; read <a href=\"http:\/\/smarter-than-the-average-pierre.blogspot.com.au\/2010\/09\/life-and-times-of-icon-uri-scheme.html\">here<\/a>.) As far as I know Safari, IE and Edge do not have such a mechanism; I&#8217;m not sure if they support listing of local directories in this fashion.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s an odd little feature in Firefox. Enter the following text into the address bar. moz-icon:\/\/.pdf?size=128 On my Linux box, it shows the following icon image. On my Windows laptop, it shows a different icon image. On my Mac Laptop, that URL doesn&#8217;t work but if I change the &#8220;128&#8221; to &#8220;64&#8221; it shows this [&hellip;]<\/p>\n","protected":false},"author":139,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/3113"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/users\/139"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/comments?post=3113"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/3113\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=3113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=3113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=3113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}