some rails helpers, use last HTML snapshot for history html (instead of body.innerHtml), clean up when changing pages