http/https与网站上的linkedin推荐不匹配

http/https mismatch with linkedin recommendations on a website

本文关键字:linkedin 不匹配 https 网站 http      更新时间:2023-09-26

我想在网站上显示我自己账户的linkedin推荐。

<script type="text/javascript" src="http://platform.linkedin.com/in.js">
    api_key: xxxx
    onLoad: onLinkedInLoad
    authorize: false
</script>
<script type="text/javascript">
    function onLinkedInLoad(){
        var target = $("#recommendation");
        IN.API.Raw("people/~:(id,first-name,last-name,recommendations-received)").method("GET").result(function(result){
            console.log("result",result);
            for(var key in result.values) {
                var recommendation = result.values[key];
                target.append($(recommendation.recommender.firstName + recommendation.recommender.lastName + recommendation.recommendationText));
            }
        });
    }
</script>

然而,当我加载页面时,我得到:

Blocked a frame with origin "https://api.linkedin.com" from accessing a frame with origin "http://127.0.0.1".  The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.
GET https://api.linkedin.com/v1/people/~:(id,first-name,last-name,recommendations-received) 404 (Not Found) 
XHR finished loading: "https://api.linkedin.com/v1/people/~:(id,first-name,last-name,recommendations-received))".

有人知道我哪里错了吗?授权设置为true或false时,我也会得到同样的结果,理想情况下,我不想要求登录,只需从我自己的个人资料中显示即可。

我在站点上集成LinkeIn-auth时遇到了同样的问题。

虽然它并没有阻止linkedin api的工作,但我很恼火地看到控制台上弹出的错误。所以我绑定了一个监听器来删除来自"https://api.linkedin.com"。

    jQuery('body').bind("DOMSubtreeModified", function(evt) {
            var elemento=evt.delegateTarget.lastChild;
            if(elemento.tagName=='IFRAME') {
                if(elemento.src.indexOf('https://api.linkedin.com')!=-1) {
                    jQuery('#'+elemento.id).remove();
                }
            }
});

一切都还在运转。