如果从其他域添加,某些 Flash 影片将无法正常工作
我正在使用链接中描述的方法(http:// www.nuff-respec.com/technology/cross-browser-cookies-with-flash),使用 Flash 实现跨浏览器跟踪。当所有部分都在同一服务器中时,一切都工作正常,但为了部署,我确实需要将 swf 从我们的中央服务器添加到另一个不同的服务器。为了简化,这是我在domain2.com中的html:
<html>
<head>
<script src="http://dom1/control_cookie.js" type="application/javascript"></script>
<script type="text/javascript">
function flash_ready() {
alert('begin!');
CB_Cookie.init('CBCookie');
CB_Cookie.set('cookie_name','value');
alert(CB_Cookie.get('cookie_name'));
};
</script>
</head>
<body>
<object id="CBCookie">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="http://dom1/CB_Cookie.swf" />
<embed src="http://dom1/CB_Cookie.swf" name="CBCookie" allowScriptAccess="always" type="application/x-shockwave-flash"/>
</object>
</body>
</html>
函数flash_ready是从swf本身调用的,所以,似乎添加正确,因为我可以看到第一个警报。但是,它停止了 CB_Cookie.init('CBCookie');
中函数的执行
我在 dom1 根目录中也有一个 crossdomain.xml,但它无论如何都不起作用...
任何想法或已知的替代方案在域之间执行此操作?先感谢您!
I'm using the method described in the link (http://www.nuff-respec.com/technology/cross-browser-cookies-with-flash) to implement a crossbrowser tracking with flash. Everything is working fine when all pieces are together in the same server, but for deploy, i really need to add the swf from our central server, to another different one. Just to simplify this is my html in domain2.com:
<html>
<head>
<script src="http://dom1/control_cookie.js" type="application/javascript"></script>
<script type="text/javascript">
function flash_ready() {
alert('begin!');
CB_Cookie.init('CBCookie');
CB_Cookie.set('cookie_name','value');
alert(CB_Cookie.get('cookie_name'));
};
</script>
</head>
<body>
<object id="CBCookie">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="http://dom1/CB_Cookie.swf" />
<embed src="http://dom1/CB_Cookie.swf" name="CBCookie" allowScriptAccess="always" type="application/x-shockwave-flash"/>
</object>
</body>
</html>
function flash_ready is called from the swf itself, so, seems to be added correctly, because I can see the first alert. However, It stops execution of the function in CB_Cookie.init('CBCookie');
I also have a crossdomain.xml in the dom1 root, but it's no working anyhow...
Any ideas or known alternatives to do this between domains? Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
重复。抱歉我之前没找到。
是跨域 Flash 本地共享对象 ( LSO 又名 Flash Cookie)可能 (stackoverflow)
解决方案位于下面的链接中:
http://magp.ie/2010/10/15/javascript-library-to-manage-flash-local-stored-objects/
Duplicated. Sorry I didn't find it before.
Are Cross Domain Flash Local Shared Objects (LSO aka Flash Cookie) possible (stackoverflow)
And the solution is in the link below:
http://magp.ie/2010/10/15/javascript-library-to-manage-flash-local-stored-objects/