dennysong

//获取源机器的协议

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

//获取绝对路径

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为https

function getprotocol(url) {
    var ishttps = \'https:\' == document.location.protocol ? true : false;
    if (ishttps) {
        return url.replace("http://", "https://");
    } else {
        return url;
    }
}

 

分类:

技术点:

相关文章: