2014年5月28日 星期三

jQuery 將網頁導到https(SSL)

最近都在架構的網站都會走SSL
所以記來以後來會用到
  
        $(function () {
            if (window.location.protocol != "https:") {
                var sslUrl = location.href.replace(/^http/i, "https");
                window.location.href = sslUrl;
                return;
            }
        });
 
參考網站
Detect HTTP or HTTPS then force HTTPS in JavaScript