What caused melting of chocolate placed near window?

When chocolate is placed near a window, it melts due to the transfer of heat from the sun. The glass of the window acts as a greenhouse, allowing the sun's infrared radiation to pass through but trapping the heat inside. This causes the temperature near the window to rise, which in turn causes the chocolate to melt. The rate at which the chocolate melts will depend on several factors, including the intensity of the sunlight, the distance of the chocolate from the window, and the ambient temperature.