If they're in front of a closed window, it's safe. Glass does not transmit UV. But they shouldn't spend too much time in front of an open window in the sun.

Smokey the Elder's tumor developed on the knee of her back leg, which was white. She loved the sun. There may or may not have been a correlation.

Just like people, moderate sunshine is good for the cats!