I dont really know what convincing argument there could be for having the client computer determine whether the page is accessed using SSL.
The issue i see is this:
You as the site developer want to force the clients experience when browsing your site to use a secure HTTPS connection.
By using javascript, the choice is no longer yours really, it is up to the client browser.
If the client browser has disabled javascript, the site visitor will not be sent to the secure HTTPS address, they will remain on the HTTP address.
To use that javascript, you would add it to the html code of the power store pagess.