In Siman 313, The Shulhan Aruch begins to outline the Halachot of "Boneh"-constructing on Shabbat. The Hachamim instituted a prohibition to return a door that has become dislodged to its place, out of concern that one will fasten it in place with a nail. Hacham Ovadia (Hazon Ovadia Shabbat Vol. 3, p. 10) discusses a case which is not included in this restriction: If a Mezuzah scroll falls out of its case on Shabbat, it is permissible to return it to its place. The scroll is not Mukse, because it is Kitveh Kodesh-holy scripture, and the Hachamim did not include such a case in their restriction.
The English Yalkut Yosef, as well as Shemirat Shabbat K'hilhata (23:32) discus a common case in which a door knob or door handle falls out of the door. They hold that it is problematic to return it to its place, as this would constitute "Boneh." It is better to use a screwdriver to open the door than to reinsert the handle, since a screwdriver is a Keli She'm'lachto L'isur and may be used L'sorech Gufo-for a permitted function. If the handle was designed to come in and out, it is permitted to reinsert it.
The new Mishna Berura Tiferet edition rules that a cobweb is Mukse and may not be broken by hand. If it is attached to the house it may also be an issue of Tolesh MeMehubar-detaching from the ground. If it was attached to a vessel, it is permitted to remove it utilizing Tiltul Min Ha'sad-indirectly, using a stick or the back of the hand.
It is permissible to return a Mezuzah scroll to its case on Shabbat.
It is prohibited to return a fallen door knob.
Cobwebs may be removed only if not attached to the house and by indirect means.