FB init function gives wrong version error

后端 未结 20 1328
故里飘歌
故里飘歌 2020-12-08 18:18

I\'m using the Facebook JS sdk, and I have created a new App today. Everything is configured properly. Using init function like:

window.fbAsyncInit = functio         


        
20条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-08 18:53

    The error happened each time I redirected to a page (Edge Browser) that had a fb-page plugin.

    If I refreshed the page it would work. If I got there through a hyperlink it would throw the error.

    Fixed it by adding sdk.js?d=" + new Date().toISOString(); to the script.

    (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/sdk.js?d=" + new Date().toISOString();
            fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    

提交回复
热议问题