Please explain how the lightguns work!

Those lightguns for Nes, up to the new Stunners for Saturn, how do they work? I mean, even if I have a smaller tv and change to a big one it still works. And it works with black and white tvs to. And I know the tv does not send any data to the console. And there cant be a camera in the gun, that is to advanced for Nes time. Please, could someone explain this?
Inside the gun is a light sensor that can "see" the raster beam. When the gun sees the beam, it tells the videochip which stores the position of the screen it was drawing at that point. This is also why the guns won't work with LCD-, plasma-, projection- or other screens which don't use rasterbeams. For more info, see Google.
And all this time I thought that the little gnomes were using their gnomey magic to make the old lightguns work! Brilliant!!