I have a vague memory of being told not to gaze at the moon through the glass of a window. I think it had something to do with kabbalah. I know it's permitted to say kiddush levanah by looking at the moon through the glass of a window if one has no other option, but I am wondering if anyone knows anything about a kabbalah-based minhag against gazing at the moon through a window?
The Magen Avraham (OC 526 sk 8) quotes the Shelah (here) that one should not look at the moon during kiddush levana but rather glance at it in the beginning and look down. The Shelah references what he wrote earlier (here) where he quotes the book Shushan Sodot (bio?) that one should not look at the moon seemingly ever. The Shushan Sodot himself (here) quotes his teacher Rabbi Meir HaLevi as teaching a new law that has no source in Torah, Neviim or Midrash that compares looking at the moon to looking at a rainbow which is forbidden per the Gemara in Chagigah 16a and codified in Shulchan Aruch OC 229:1. He says that the moon represents the House of David and that when the moon is diminished it somehow represents a diminishing of some spiritual forces.
I admit I'm not really sure what's going on here, not being a kabbalist myself. It does at least seem that there is some kabbalistic reason for not looking at the moon even not during kiddush levana and even when not looking through windows.
Optimally, one should recite Birkat Ha'levana outdoors, rather than while looking at the moon through a window indoors. This Halacha, stems from the notion that one greets the Shechina when reciting this Beracha, thus requiring that one leave his building to go greet the Almighty.
For Kiddush Levana there is a special reason why one should not do it through a window, however there is no problem looking at the moon through a window at any other time.