chrome中页面有跨域iframe出现Adobe Flash Player安全性设置窗口

http://bbs.9ria.com/viewthread.php?tid=85933&extra=page%3D1%26amp%3Borderby%3Ddateline%26amp%3Bfilter%3D2592000

 

 

本帖最后由 bcpxqz 于 2011-6-16 17:38 编辑

a. html和b.html不同域,a.html用iframe嵌入b.html,在chrome中有时候会出现 Adobe Flash Player安全性设置窗口(图1),在console面板中可以看到,四条"Unsafe  JavaScript attempt to access frame with URL"错误,但如果你看图2,就会发现,
  1. "Unsafe JavaScript attempt to 
  2. access frame with URL http://a.com/adtest/39iframe/d1.html from frame 
  3. with URL http://a.com/adtest/39iframe/d1.html. Domains, protocols and 
  4. ports must 
  5. match."
复制代码
是同一页面。我想知道问题出在哪里?在其他ie,firefox,safari,opera里面测试不会出现这个设置窗口,在 google code上也有讨论: http://t.cn/aK3flf http://t.cn/aK3flV 。


chrome:10.0.648.45
flash  player:10,2,154,12

代码如下:
a.htm页面结构
  1. <embed id="test1" name="test1" width="100" height="100" 
  2. type="application/x-shockwave-flash" 
  3. pluginspage="http://www.macromedia.com/go/getflashplayer" 
  4. allowscriptaccess="always" allowfullscreen="true" quality="high" 
  5. menu="false" wmode="transparent" src="blank.swf?num=outer">
  6. <iframe
  7. width="100" scrolling="no" height="100" frameborder="0" 
  8. allowtransparency="true" marginheight="0" marginwidth="0" 
  9. src="http://b.com/b.html" name="iframe1" 
  10. id="iframe1"></iframe>
复制代码
其中blank.swf中
import flash.external.ExternalInterface;
ExternalInterface.call("console.info",str);

Iframe b.html页面结构
  1. <embed id="AC86_5500" name="AC86_5500" width="100" 
  2. height="100" type="application/x-shockwave-flash" 
  3. pluginspage="http://www.macromedia.com/go/getflashplayer"  allowfullscreen="true"
  4. quality="high" menu="false" wmode="transparent" 
  5. src="blank1.swf">
复制代码
其中blank1.swf,没有引入flash.external.ExternalInterface,是个空flash

 

 

 

 

 

 

本帖最后由 ticore 于 2011-6-17 18:59 编辑

http://blog.richmediaplus.com/20 ... omain-inject-issue/


反覆測試之後,將問題簡化如下:

1. a.com 下的 HTML 網頁,包含一個 b.com 來的 iframe 網頁
2. b.com iframe 網頁內使用 javascript touch 一下 window.top.location
3. a.com 在 onload 完成後,動態建立一 Flash 物件
4. Flash 物件內透過 ExternalInterface 呼叫任何 Javascript Function
5. 得到以下錯誤訊息

SecurityError: Error #2060: 執行程序安全性違規:ExternalInterface 呼叫者http://a.com/flash.swf 無法存取 [object]。
at flash.external::ExternalInterface$/_initJS()
at flash.external::ExternalInterface$/call()
at flash_fla::MainTimeline/doCallJs()

已經簡化成這樣,很明顯問題是出在 javascript window.top.location 物件上
想要避免該問題,只要在主頁上一載入立即搶先 touch window.top.location 就好了

在測試過程中,還發現另一個更嚴重的問題
跨域的 iframe 能夠透過原型鍊 prototype 插入任意 function 到 location 物件上
讓 top window 頁面呼叫並傳遞任何物件
不受跨網域安全性的限制
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值