Expanding foam is a urethane-based product which begins to expand and harden once it comes into contact with air. Expanding foam is typically used for small insulation projects, for example around door and window casing. A simple and inexpensive way to keep expanding foam from sticking to other surfaces is to use a little masking tape and wax paper.
Cut the wax paper to proper length. Measure the area to which you do not want the expanding foam to stick and cut the wax paper accordingly.
Tear off a few pieces of masking tape. Having a few pieces of masking tape ready when you first position the wax paper in the area you want gives you a free hand to hold the wax paper in place while affixing the tape.
Tape the wax paper to the remainder of the surface. Don't worry if part of the area you tape is to be covered in expanding foam, as the foam will stick to the tape but not to the wax paper.
Check for gaps in the tape. Expanding foam will seep into any gaps in the masking tape and stick to the surface below. Re-tape any gaps you find.
Spray the foam. Once you have rechecked the surface area for gaps, you can begin spraying your expanding foam.