How does the "heat vision" of some snakes work?
Vipers, pythons and boas have holes on their faces called pit organs (Moon, 2011), which contain a membrane that can detect infrared radiation from warm bodies up to one meter away (Fig. 1). At night, the pit organs allow snakes to sense an image of their predator or prey (Source: Nature).


Fig. 1. Pit organs in python (top) and viper (bottom) as indicated by arrows. Source: Wikipedia

Nerve cells in the pit organ contain an ion channel called TRPA1, which detects infrared radiation as heat. The pit organ is part of the snake's somatosensory system, which detects touch, temperature and pain. It does not receive signals from the eyes. Hence, snakes sense infrared by detecting heat, not photons of light. Infrared radiation heats up the pit membrane tissue, and TRPA1 channels open when a threshold temperature is reached, allowing ions to flow into the nerve cells and triggering an electrical signal (Gracheva et al., 2010). Rattlesnake TRPA1 is activated by temperatures higher than about 28 °C — roughly the temperature a snake would 'feel' from a mouse or a squirrel about a meter away (Source: Nature).

Hence, this organ works best in cold environments where temperatures are low so that warmblooded prey stands out. Further, warmblooded animals won't be able to use this organ, as the pit would be ~37oC and not be able to detect anything below that temperature.

References
- Gracheva et al., Nature (2010); 464: 1006-11
- Moon, Anat Cell Biol (2011); 44(1): 8–13