Hello Izabee33 this is unhealthy for your dragon i am surprised that he hasn't gotten ill over a long period of time like this, unless you are taking him outside daily to get the proper UVB that he needs. UVB rays can not penetrate glass so if you have him in a glass tank and the sun is beaming through the window your beardie will not get any UVB at all. I recommend opening up your window and placing a basking spot there. He shouldn't be able to jump out the window if you have a screen. If you don't i would highly recommend one if you are going to take this route.