First, to clarify, it is the wielder, not the caster, who must hold it, so it can be cast on an ally's weapon, but not cast on a weapon which is then handed to an ally.
That said, I would take "drops it or otherwise loses contact with it" to include ranged weapons and thus not allow it. Even...