5

I am making a client for Stack Overflow... I want to show the icons for Stack Exchange network/sites... found some CSS that contains something like:

.favicon-english {
  background-position: 0 -2196px
}

.favicon-englishmeta {
  background-position: 0 -2214px
}

.favicon-es {
  background-position: 0 -2232px
}

But it seems the correlation between the favicon-<name> is done serverside? Does anyone know or found any code that has the <name> and something from the site, like the number or the name? I'm trying to find any JavaScript code that has it, but I couldn't find it...

3
  • have the image for it, but not the name/id or name/site name relation
    – UXDart
    May 29, 2017 at 17:46
  • 1
    The offsets are to the CSS sprite that holds all images; since that sprite is generated together with the CSS, the numbers are generated at that time and are not meant for 3rd-party use. Better to use the individual images served by the API.
    – Martijn Pieters Mod
    May 29, 2017 at 17:51
  • @MartijnPieters yes, thanks, will use that
    – UXDart
    May 29, 2017 at 17:52

1 Answer 1

7

No need to mess around with CSS files, separate icons are already available in the API: https://api.stackexchange.com/docs/sites

Example for Stack Overflow:

"high_resolution_icon_url": "https://cdn.sstatic.net/Sites/stackoverflow/img/[email protected]",
"favicon_url": "https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico",
"icon_url": "https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon.png",
1
  • ha... didn't saw that method in the api... thanks! anyway would be nice to be able to use the "only one image"... but that will work, thanks
    – UXDart
    May 29, 2017 at 17:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .