When light refracts in a prism it creates a rainbow. My question is, why don’t all windows or transparent objects create this dispersion, i.e. why is the refractive index dependent on frequency in a dispersive prism, and not in a window? (My guess is that the refractive index doesn’t change as much, but I don’t really have an idea).
It does create the rainbow, but it is almost impossible to notice.
When light direction is changed on the glass-air interface - there is always a dispersion : light with different wavelength will refract at different angle and thus create rainbow.
The issue is that when light hits second glass-air interface - incidence angle is opposite, and dispersion almost perfectly compensate, and this recombine light into white beam. In this recombined beam there is no angular difference for different colors, just slight lateral mismatch - so you can barely see rainbow at the sharp edges of light beam - but colors do not diverge anymore.
You can still notice rainbow if you take very thick glass (~50mm), and very narrow and perfectly collimated beam (<0.05mm). Here you can see simulation with exaggerated dispersion:
In a prism, where incidence angles for first and second refractions are very different - this compensation is not working and one can see the rainbow much easier, as there is now angular difference between different colors.
The glass panes in a window don't actually deflect light based on their refractive index (at least not to a reasonable approximation).
The image shows that if you shine a ray at a perfect rectangle, the light comes out parallel to the incident ray. Thus you don't get dispersion, because there is no net deflection being caused. (For clarity: there deflection at each plane, it just cancels. This deflection is different for each wavelength, so there is a tiny translational shift due to wavelength. But no angular deflection as in a prism.)
Of course, windows don't have perfectly parallel sides, and if you extended them far enough they'd eventually meet. As such, a window looks like a prism with a very small apex angle $A$.
Combining BarsMonster's and jacob1729's answers, and UKMonkey's comment, when light hits the air-to-glass interface, difference frequencies of light are refracted at different angles, and there is then dispersion throughout the thickness of the thickness of the glass. If the sides of the glass are parallel, then the refraction at the glass-to-air interface on the other side will be opposite to the original refraction, and there will be no further dispersion; that is, there will be dispersion only within the thickness of the glass.
With a prism, on the other hand, the sides are not parallel but rather at opposite angles to the base. Because of this, the refraction at the glass-to-air interface reinforces, rather than cancels out, that of the air-to-glass interface. Thus, the dispersion continues after the light leaves the prism.
In addition, a prism is thicker but shorter than a window (generally). That is, there is a smaller cross section of light going through more glass. With more dispersion and smaller beam, the prism can separate the different colors into a spectrum. A window, on the other hand, has a large beam with small dispersion, and so the different colors overlap each other.