The collective collisionless dynamics of the electron gas in free-electron nanofilms irradiated by an obliquely incident p-polarized laser wave are considered in the classical hydrodynamic and jellium-model approximations. The two cases of cold metallic nanofilms and hot free-electron nanofilms laser ionized and laser heated by a pump-laser prepulse are investigated with proper electron statistics. Both linear and nonlinear properties of the plasma resonance excitation in the nanofilms are studied in detail for different film parameters ͑film thickness, thickness of the diffuse film boundary, outer-ionization degree for hot laser-ionized/heated films, etc.͒. The significant role of the diffuse film boundaries for both linear absorption of the laser field and third-harmonic generation is demonstrated. For this goal, we do not use the standard dielectric-permittivity approach with boundary conditions between two different media but solve continuously over all space the full set of hydrodynamic and electrodynamic equations in nonrelativistic one-dimensional approximation. It is shown that collisionless edge absorption may be dominant in thin nanofilms, while in cold metal nanofilms it results in the appearance of several linear-absorption resonances below the bulk-plasma resonance frequency. For hot nanofilms, drastic broadening of the linear-plasma-resonance profile is obtained in calculations when the film thickness is reduced. In our model, the third-harmonic generation is determined by the density gradient in the diffuse film edges. Additional resonances in third-harmonic generation as a function of laser frequency are obtained for cold metal nanofilms. They differ from the standard third-order nonlinear resonance, which is located at one third of the plasma resonance frequency. The important role of the outer-ionization degree in forming the third-order nonlinear response of the hot laser-ionized film is also analyzed and discussed.