Add loading screen on beforeunload