The invention relates to a cosmetic method for treating human body odors. Said method includes:(i) applying, to the skin, a composition containing a polymer (I):wherein R′ is, separately, H or an acetyl grouping or a —CO-L-X grouping, the polymer containing at least one R′═—CO-L-X grouping,L being a divalent hydrocarbon group containing 1 to 20 carbon atoms,X denoting a photoactive azide or diazirine group,and n ranging from 5 to 2000;then (ii) exposing the skin to visible light.The method used on the skin can also be used on materials for deodorizing malodorous environments such as shoe soles or clothing.