Javascript facebook sdk登录本地
我已经在sdk中登录了Facebook 它在我的服务器上运行良好,但我需要在本地路径中使用它file://path 当用户在线,但它不工作,我点击按钮没有任何效果,这是代码Javascript facebook sdk登录本地,javascript,html,facebook,facebook-graph-api,facebook-javascript-sdk,Javascript,Html,Facebook,Facebook Graph Api,Facebook Javascript Sdk,我已经在sdk中登录了Facebook 它在我的服务器上运行良好,但我需要在本地路径中使用它file://path 当用户在线,但它不工作,我点击按钮没有任何效果,这是代码 <html> <head> <link rel="stylesheet" type="text/css" href="../css/style.css"> <meta name="viewport" content="width=320, initial-scale=0.7
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/style.css">
<meta name="viewport" content="width=320, initial-scale=0.7, user-scalable=no">
<script src="JS/jquery-1.11.1.js.js"></script>
<link rel="stylesheet" type="text/css" href="../css/login.css">
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'MYAPPID', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe('auth.authResponseChange', function(response)
{
if (response.status === 'connected')
{
window.location.replace("gestaccount.html");
}
else
{
}
});
};
function Login()
{
FB.login(function(response) {
if (response.authResponse)
{
} else
{
window.location.replace("errorconn.html");
}
},{scope: 'email,user_photos,publish_actions'});
}
// Load the SDK asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
</head>
<body style=" background: #2c3338;
color: #606468;
margin: 0;">
<div id="navigation">
<table width="100%">
<tr valign="bottom">
<td valign="middle" width="25%" align="center">
<a href="eventi.php"><img src="IMG/icon/prvs.png" class="icons3"/></a>
</td>
<td valign="bottom" width="50%" align="center">
<img src="IMG/LOGO-WHITE.png" class="logonbar" alt="DONUT"/>
</td>
<td width="25%" align="center" valign="middle">
</td>
</tr>
</table>
</div>
<div id="fb-root"></div>
<br>
<div class="containerlogin">
<br><br><br><br><br>
<div id="login" style="display: block; margin:0 auto;" >
<img src="../IMG/LOGIN.png" class="iconlogin" alt="" style="display: block; margin: 0 auto;"/>
<p> <button type="submit" name="fb" onClick="Login()" class="button"> </button>
<p style="margin-left:25px;">Loggati e avrai la possibilità di tenere controllati
tutti le tue prenotazioni tra prevendite e tavoli.
Inoltre se sei PR contattaci per avere accesso a tutte
le funzionalità riservate. </p>
</div> <!-- end login -->
</div>
<br>
<br>
</div>
</div>
</body>
</html>
谢谢您的回答。它只适用于http或https协议,不适用于文件:// Facebook不再支持从本地文件进行JS SDK调用,脚本必须在具有http://或https://URI的文件上运行
如果您想在本地测试它,请尝试在本地主机上运行它是否有方法调用驻留在本地页面服务器上的javascript登录函数@答:B不要因为复杂性而使用像webstorm这样的ide,他们csam为您提供本地主机,甚至安装wamp并在www folder@marcodevelopingcenter中测试它。我使用的是phonegap。有没有办法使用它呢@答:Bi遇到了这个问题,据我记忆所及,我必须进行应用程序登录,而不是facebook应用程序的web应用程序,在该应用程序中,如果我将localhost放在ftp.mydomain works的本地路径中,您必须提供主活动类etc@marcodevelopingcenter的名称file://mypath 不起作用,正常吗@A.B