Demo: https://zxccxz0119.github.io/example/fbapi.html
<script src="https://zxccxz0119.github.io/assets/fbapi.js"></script>
<button onClick="login()">login & get info</button>
<button onClick="fbapi.share('https://www.w3schools.com/')">share</button>
var fbapi = new FBApi({
appId: 'your_appid',
version: '', // default is 'v6.0'
})
function login(){
fbapi.login().then(()=>{
return fbapi.getProfile()
}).then((res) => {
console.log(res)
})
}
fbapi.checkStatus()
fbapi.login()
fbapi.getProfile()
alertOpen
is boolean
, default is true
.
fbapi.share(link,alertOpen)