[英]Facebook JavaScript API for google chrome extension
I make a chrome extension to like specific page posts automatically. 我自动将Chrome扩展程序设为特定页面帖子。 With a simple popup controller and background thread to handle fb api interactive
用一个简单的弹出控制器和后台线程来处理fb api交互
I cannot load facebook js api into extension page with official example method. 我无法使用官方示例方法将facebook js api加载到扩展页面。
The script jssdk was loaded and executed checked by chrome developer tools. 脚本jssdk由chrome开发人员工具加载并执行检查。
But window.FB is not defined by script loaded!!! 但是window.FB没有被加载的脚本定义!!!
I don't have a solution, but this might lead you in the right direction. 我没有解决方案,但这可能会引导您朝着正确的方向前进。
The problem might be with the document.location of the extension document. 问题可能在于扩展文档的document.location。 For javascript running in the extension scope, the protocol is "chrome-extension://", while many JS libraries expect either "http" or "https".
对于在扩展范围内运行的javascript,协议是“chrome-extension://”,而许多JS库需要“http”或“https”。
From looking at the following line at the jssdk file, it seems that FB make this assumption as well: 通过查看jssdk文件中的以下行,似乎FB也做出了这样的假设:
var k = typeof j == 'undefined' ? location.protocol.replace(':', '') : j ? 'https' : 'http';
Try debugging these cases, replacing the line above with something like: 尝试调试这些情况,用以下代码替换上面的行:
var k = 'http';
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.