It is possible to get a tan through an ordinary glass window but much more slowly than when exposed to sunlight directly in the open air.
Sunlight reaching us on earth contains two types of ultraviolet (or UV) rays, called UVA and UVB. Glass filters sunlight passing through a window and removes most of the UVB rays, the type that causes sunburn and skin cancers, but a significant amount of the UVA rays still pass through and can reach the skin. UVA rays cause tanning of the skin but are also linked to premature skin ageing, wrinkles and cancer.
A double-glazed window offers more protection as two panes of glass will absorb more of the UV rays. Certain special glass coatings are designed to offer more protection by filtering out substantially all UV rays.