我正在尝试弄清楚如何允许用户从 Flash 中单击 Google+“+1”按钮。通过阅读 Google+ 文档并检查他们的脚本正在执行的操作,我没有看到任何方法,并且想知道是否有人已经解决了这个问题。
问题是他们的脚本创建了一个指向 Google 子域的 iFrame。因此,由于跨域策略,我无法触发按钮单击。我不能简单地调用他们正在调用的相同 URI,因为它已被编码并且它们的编码可能会改变。我找不到任何有关如何以编程方式调用 +1 等的文档...
有什么想法吗?
I'm trying to figure out how to allow users to click on a Google+ "+1" button from within Flash. From reading through the Google+ docs and examining that their script is doing, I don't see a way and was wondering if anyone's solved this yet.
The problem is that their script creates an iFrame which points at a Google subdomain. So I can't trigger a button click due to cross-domain policy. I can't simply call the same URI that they're calling because it's encoded and their encoding may change. I can't find any documentation on how to programmatically call a +1, etc...
Any ideas?
发布评论
评论(1)
Google Plus 没有可以直接嵌入 flash 的 +1 按钮版本,以及 API 他们刚刚发布的是只读的,因此您不能使用 方法 通常适用于 facebook like 按钮。
我的建议是在 Flash 对象顶部有一个绝对定位的 DIV 标记,您将在需要时调用该标记,并且可以使用 href 参数。我使用显式模式进行标记渲染,以展示如何动态准备标记。
下面是一些使用 jquery 制作动画的示例代码。
您还可以在 jsfiddle 上测试此示例代码。
Google Plus does not have a version of +1 button which can be directly embedded into flash, and the API they have just released is read-only, therefore you can't use methods which normally works for the facebook like button.
What I'd suggest is to have an absolutely positioned DIV tag on top of your flash object which you will invoke when needed, and you can pass the correct URL to "like" using the href parameter. I'm using explicit mode for tag rendering to show how you can dynamically prepare the tag.
Here's some sample code which uses jquery for the animations.
You can also test this sample code on jsfiddle.