fixes #1679924 by Dave Cohen: Infinite reloads, aggressive cache and third-party cookie problems, and other javascript improvements