Midinfrared absorption can be locally measured using a detection combining an atomic force microscope and a pulsed excitation. This is illustrated for the midinfrared bulk GaAs phonon absorption and for the midinfrared absorption of thin SiO(2) microdisks. We show that the signal given by the cantilever oscillation amplitude of the atomic force microscope follows the spectral dependence of the bulk material absorption. The absorption spatial resolution achieved with microdisks is around 50 nanometer for an optical excitation around 22 micrometer wavelength.