我目前正在製作Facebook JavaScript應用程序。因此我真的只是複製粘貼出來的文檔到我的網頁,我不斷收到在控制檯以下錯誤:Facebook Uncaught安全性錯誤
Uncaught SecurityError: Blocked a frame with origin "http://static.ak.facebook.com" from accessing a frame with origin "http://localhost:8080". Protocols, domains, and ports must match. VM2813:1
Uncaught SecurityError: Blocked a frame with origin "https://s-static.ak.facebook.com" from accessing a frame with origin "http://localhost:8080". The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.
VM2817:1
Uncaught SecurityError: Blocked a frame with origin "http://static.ak.facebook.com" from accessing a frame with origin "http://localhost:8080". Protocols, domains, and ports must match.
因此然後,我添加http://localhost:8080
到我的Facebook應用程序頁面,但我仍然會有同樣的錯誤。
這裏是我使用的代碼:
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '644205045632878',
status : true,
xfbml : true
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
</body>
請某人能解釋什麼是錯在這裏。這是我第一次這樣做......
我猜測您的用戶設置中啓用了「安全瀏覽」,因此您的服務器還需要能夠通過HTTPS進行響應... – Tobi