[英]http/https mismatch with linkedin recommendations on a website
我想在網站上顯示來自我自己帳戶的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 ”的所有iframe。
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();
}
}
});
一切仍在進行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.