An overview is presented of the H2 quasar absorption method to search for a possible variation of the proton-electron mass ratio μ=mp/me on a cosmological time scale. The method is based on a comparison between wavelengths of absorption lines in the H2 Lyman and Werner bands as observed at high redshift with wavelengths of the same lines measured at zero redshift in the laboratory. For such comparison sensitivity coefficients to a relative variation of μ are calculated for all individual lines and included in the fitting routine deriving a value for Δμ/μ. Details of the analysis of astronomical spectra, obtained with large 8-10 m class optical telescopes, equipped with high-resolution echelle grating based spectrographs, are explained. The methods and results of the laboratory molecular spectroscopy of H2, in particular, the laser-based metrology studies for the determination of rest wavelengths of the Lyman and Werner band absorption lines, are reviewed. Theoretical physics scenarios delivering a rationale for a varying μ are discussed briefly, as well as alternative spectroscopic approaches to probe variation of μ, other than the H2 method. Also a recent approach to detect a dependence of the proton-to-electron mass ratio on environmental conditions, such as the presence of strong gravitational fields, are highlighted. Currently some 56 H2 absorption systems are known and listed. Their usefulness to detect μ variation is discussed, in terms of column densities and brightness of background quasar sources, along with future observational strategies. The astronomical observations of ten quasar systems analyzed so far set a constraint on a varying proton-electron mass ratio of |Δμ/μ|<5×10-6 (3σ), which is a null result, holding for redshifts in the range z=2.0-4.2. This corresponds to look-back times of (10-12.4)×109 years into cosmic history. Attempts to interpret the results from these ten H2 absorbers in terms of a spatial variation of μ are currently hampered by the small sample size and their coincidental distribution in a relatively narrow band across the sky.