Facebook channel URL for Cordova app

末鹿安然 提交于 2019-12-11 08:57:37

问题


I am working on a HTML5 mobile app, using cordova 2.6, and I am targetting iOS, Android BlackBerry and Windows Phone.

I am trying to implement Facebook sharing feature using Facebook JavaScript SDK. I am trying to do it inside Corodova InAppBrowser

My FB.init function is as following:

  FB.init({
        appId      : '0000000000',
        channelUrl : './js/libs/fb/channel.html',
        status     : true
      });

I am having the error :

Is there anything wrong with my Facebook app configuration, or my FB.init function?


回答1:


If you wish to use Facebook JS SDK methods inside a phonegap project, you need to use the Facebook Plugin

When you try doing it as a regular website, Facebook blocks you since you didn't provide them the authorized domain. the problem is, your JS code runs locally on each device so you don't have such a domain, and therefor you cannot use the Facebook JS SDK.

you can avoid the plugin by using some other methods, like a using a childbrowser plugin (look at: this example)

good luck



来源:https://stackoverflow.com/questions/19652002/facebook-channel-url-for-cordova-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!