Yes, given its light adhesion, you can apply painter’s tape to windows.

In order to mask windows, start at any corner of the trim, and stick your painter’s tape on the trim where it meets the wall. Apply your tape in 4- or 5-foot segments in order to prevent the tape from adhering to itself. Run a card or other hard plastic tool along the edge of the tape, firmly pressing it against the trim. This will prevent paint from seeping under the edge of your tape, leaving you with clean lines.

Then, unfold a plastic sheet and place the top edge under the flap of the tape along the top of the window. You will then want to fold the tape down in order to hold onto the plastic. Simply repeat the process on all sides of the window to create a mask for the entire surface.