开发本地主机上的Facebook连接的Javascript API [英] Developing Facebook Connect Javascript API on localhost

查看:111
本文介绍了开发本地主机上的Facebook连接的Javascript API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着写一些JavaScript函数与Facebook的整合流。不过,他们似乎只如果您正在开发他们直接在现场服务器上的工作,使Facebook能够访问 xd_receiver.htm 文件,他们问我在<$ C $的地方C> www.mydomain.com/xd_receiver.htm 。然而,你都可以或许同意,不活的服务器上开发是非常重要的。

I'm trying to write some javascript functions to integrate with the Facebook stream. However they only seem to work if you are developing them directly on the live server so that Facebook can access the xd_receiver.htm file that they ask me to place at www.mydomain.com/xd_receiver.htm. However you all can probably agree that it's really important not to develop on the live servers.

下面是我到目前为止已经试过:

Here's what I've tried so far:


  1. 配售 xd_receiver.htm 现场服务器和我的开发服务器上运行我的脚本希望API密钥会告诉Facebook服务器查找 xd_receiver.htm 我的现场服务器...没有运气

  2. 注册与Facebook两个API密钥:一个开发重点指向127.0.0.1,活的指着我的生活网站。这里的理论是,如果 xd_receiver.htm 只需要在本地那么它会通过127.0.0.1找到它...没有运气

  1. Placing xd_receiver.htm on the live server and running my scripts on my dev server hoping that the API Key would tell the Facebook server to look for xd_receiver.htm on my live server...no luck
  2. Signing up for two API Keys with Facebook: a dev key pointing to 127.0.0.1 and a live one pointing to my live site. The theory here was that if xd_receiver.htm was only needed locally then it would find it via 127.0.0.1...no luck

有没有人想出了一个办法做到这一点?他们不能指望我们发展我们的Facebook应用程序纯粹是生活在没有开发的沙箱。

Has anyone figured out a way to do this? They can't expect us to develop our Facebook Apps purely live without a dev sandbox.

有关它的价值的一些背景资料:使用ASP.NET用VB,但希望用纯粹的JavaScript

Some background info for what it's worth: Using ASP.NET with VB but hoping to use purely Javascript.

推荐答案

这是绝对有可能使用本地xd_receiver.htm文件。我是通过贸易的Facebook应用程序开发人员,我有几十人成立。

It's definitely possible to use local xd_receiver.htm files. I'm a Facebook app developer by trade, and I have dozens of them set up.

您是最接近正确答案上面的#2。做到这一点的方法是创建您的应用程序的两个版本。如果我做MyApp的,可能我的myapp和的myapp-dev的,以及www.myapp.com和192.168.1.1的相应帆布回调2个URLs的画布页面的URL。每个人都是一个独立的Facebook应用程序,用自己的API密钥等。

You're closest to the correct answer with your #2 above. The way to do it is create two versions of your app. If I was making "MyApp", I might have two Canvas Page urls of "myapp" and "myapp-dev", and corresponding Canvas Callback URLs of "www.myapp.com" and "192.168.1.1". Each one is a separate Facebook app, with their own API key, etc.

apps.facebook.com/myapp会去我的直播服务器,apps.facebook.com/myapp-dev会去我的地方发展机。你必须确保Facebook能够得到,当然你的开发机器。

apps.facebook.com/myapp would go to my live server, and apps.facebook.com/myapp-dev would go to my local development machine. You have to make sure Facebook can get to your development machine of course.

然而,事情应该从那里工作得很好。你甚至都不需要不同版本的文件xd_receiver.htm的,因为文件的内容始终是每一个应用程序是相同的。只要你的 FB.XdComm.Server.init(/ xd_receiver.htm); 行指向正确的文件,它应该工作

However, things should work just fine from there. You don't even need different versions of the xd_receiver.htm file, as the file contents are always the same for every app. AS long as your FB.XdComm.Server.init("/xd_receiver.htm"); line points to the right file, it should work.

我管理一个配置文件API密钥和路径和这样的,并且每个应用程序一个配置文件,无论是一个开发或生产应用。这使得它很容易在应用页面输出正确的键和路径。

I manage API keys and paths and such in a configuration file, and have one configuration file per application, whether it be a dev or production app. That makes it easy to output correct keys and paths on the app pages.

您可以保持你的开发应用程序的沙盒模式,做你的本地计算机上的所有工作。

You can keep your development app in sandbox mode and do all the work on your local machine.

这篇关于开发本地主机上的Facebook连接的Javascript API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆