Nicholas Nethercote: moz-icon: a curious corner of Firefox |
Here’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’t work but if I change the “128” to “64” it shows this icon image.
In each case we get the operating system’s icon for a PDF file.
Change the “size” (up to a maximum of 255) value and you’ll get a different size. Except on Mac the limit seems to be lower, probably due to the retina screen in some way.
Change the file extension and you’ll get a different icon. You can try all sorts, like “.xml”, “.cpp”, “.js”, “.py”, “.doc”, etc.
How interesting. So what’s this for? As far as I understand, it’s used to make local directory listing pages look nice. E.g. on my Linux box if I type “file:///home/njn/” into the address bar I get a listing of my home directory, part of which looks like the following.
That listing uses this mechanism to show the appropriate system icon for each file type.
Furthermore, this feature is usable from regular web pages! Just put a “moz-icon” URL into an
That’ll only work on Firefox, though. Chrome actually has a similar mechanism, though it’s not usable from regular web pages. (For more detail — much more — read here.) As far as I know Safari, IE and Edge do not have such a mechanism; I’m not sure if they support listing of local directories in this fashion.
https://blog.mozilla.org/nnethercote/2015/11/05/moz-icon-a-curious-corner-of-firefox/
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |