This one seems so simple but I still wanted to drop a quick reference to it here. Very simply: if you have a need to keep your users on https with javascript, this will do the trick.