HTTP協議改HTTPS

//獲取源機器的協議ide

string protocol = Request.Url.AbsoluteUri.ToLower().IndexOf("https") != -1 ? "https://" : "http://";

//獲取絕對路徑url

function getAbsoluteUrl(url) {
    var a = document.createElement('A');
    a.href = url; 
    url = a.href;  
    if (url.indexOf('/player/video.aspx') != -1) {
        return url.toLowerCase().replace("https", "http");
    }
    return url;
}

//替換http爲httpsspa

function getprotocol(url) {
    var ishttps = 'https:' == document.location.protocol ? true : false;
    if (ishttps) {
        return url.replace("http://", "https://");
    } else {
        return url;
    }
}
相關文章
相關標籤/搜索