Why do cockpit windows often appear to have a rainbow ‘tint’? It’s similar to what you would see when looking at a shallow puddle of water with oil on top. Here is an example of a B777 cockpit window with the same rainbow effect:
Thin-film interference is a natural phenomenon in which light waves reflected by the upper and lower boundaries of a thin film interfere with one another, either enhancing or reducing the reflected light.
It's the same mechanism behind your oil example. The thin film in this case is the heating coating applied to the windshield, which is intentionally non-uniform (explained below), making the effect even stronger.
Fringes observed on a windshield due to thin film interference caused by a conductive Indium Tin Oxide (ITO) thin film deposited on the window for electrical defrosting/defogging.
The fringes are strongly visible because the thin film thickness is highly non-uniform on purpose: as the voltage is applied on two opposite points of the window, a uniform conductive film (uniform sheet resistance) would lead to non-uniform current density, and non-uniform defrosting. Some window parts, especially on the sides and far from the electrical contacts, would dissipate less heat, and defrosting would be significantly less efficient here. The ITO thickness pattern is cleverly designed to provide a rather uniform heat dissipation over the whole window.