Flash Player 上的外部 Javascript 接口无法在 CDN (Cloudfront) 上运行
我有一个带有外部 javascript 接口的 Flash 播放器: reloadData() 我在编辑页面上的信息时通过 Javascript 调用该函数 - 基本上是为了保持页面上和播放器中的数据同步。
当播放器托管在本地时,reloadData() 函数可以正常工作。当我们将其移动到 CDN(Amazon Cloudfront)时,播放器加载成功,但外部 javascript 接口不再工作 - console.log(player) 显示以下内容:
<object type="application/x-shockwave-flash" data="[our_cloudfront_url].swf" width="920" height="404" id="player" style="visibility: visible; ">
Uncaught TypeError: Object #<an HTMLObjectElement> has no method 'reloadData'
我知道在使用时有很多行为不同的事情CDN 上的项目,但我想知道是否有人遇到过类似的问题并找到了解决方案。
哦,是的...我们使用 CNAME 指向 cloudfront 发行版 (buildid.ourdomain.net => distributionid.cloudfront.net)
I have a flash player with an external javascript interface: reloadData() I'm calling that function via Javascript when editing information on the page - basically to keep data on the page and in the player in synch.
The reloadData() function works fine when the player is hosted locally. When we move it to the CDN (Amazon Cloudfront), the player loads successfully, but the external javascript interface no longer works - console.log(player) reveals the following:
<object type="application/x-shockwave-flash" data="[our_cloudfront_url].swf" width="920" height="404" id="player" style="visibility: visible; ">
Uncaught TypeError: Object #<an HTMLObjectElement> has no method 'reloadData'
I know there are a lot of things that behave differently when working with items on a CDN, but I'm wondering if anyone has experienced a similar problem and figured out a fix.
Oh, yeah...we're using a CNAME to point to the cloudfront distribution (buildid.ourdomain.net => distributionid.cloudfront.net)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我们解决了这个问题。有两件事是必需的:
嵌入 swf 时的页面上:allowScriptAccess="always"
在 swf 本身中:System.security。 allowDomain("ourdomain.com")
我想这有点明显,但我想我应该将其发布在这里以防其他情况像我这样可怜的迷失的灵魂也面临着同样的问题。
Well, we figured this one out. Two things are necessary:
On the page when embedding the swf: allowScriptAccess="always"
In the swf itself: System.security.allowDomain("ourdomain.com")
I guess this is sort of obvious, but I figured I'd post it here in case some other poor lost soul such as myself is having the same problem.