Whenever in the opinion of the court it is proper that the jury should have a view of real property which is the subject of litigation, or of the place in which any material fact occurred, it may order the jury to be conducted in a body, in the custody of a proper officer, to the place which shall be shown to them by the judge or by a person appointed by the court for that purpose. While the jury are thus absent no person other than the judge, or person so appointed, shall speak to them on any subject connected with the trial.