chrome中页面有跨域iframe出现Adobe Flash Player安全性设置窗口http://bbs.9ria.com/viewthread.php?tid
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,就会发现,
- "Unsafe JavaScript attempt to?
- access frame with URL http://a.com/adtest/39iframe/d1.html from frame?
- with URL http://a.com/adtest/39iframe/d1.html. Domains, protocols and?
- ports must?
- match."
复制代码是同一页面。我想知道问题出在哪里?在其他ie,firefox,safari,opera里面测试不会出现这个设置窗口,在google?code上也有讨论:http://t.cn/aK3flfhttp://t.cn/aK3flV?。


chrome:10.0.648.45
flash?player:10,2,154,12
代码如下:
a.htm页面结构
- <embed id="test1" name="test1" width="100" height="100"?
- type="application/x-shockwave-flash"?
- pluginspage="http://www.macromedia.com/go/getflashplayer"?
- allowscriptaccess="always" allowfullscreen="true" quality="high"?
- menu="false" wmode="transparent" src="blank.swf?num=outer">
- <iframe
- width="100" scrolling="no" height="100" frameborder="0"?
- allowtransparency="true" marginheight="0" marginwidth="0"?
- src="http://b.com/b.html" name="iframe1"?
- id="iframe1"></iframe>
复制代码其中blank.swf中
import flash.external.ExternalInterface;
ExternalInterface.call("console.info",str);
Iframe b.html页面结构
- <embed id="AC86_5500" name="AC86_5500" width="100"?
- height="100" type="application/x-shockwave-flash"?
- pluginspage="http://www.macromedia.com/go/getflashplayer"??allowfullscreen="true"
- quality="high" menu="false" wmode="transparent"?
- 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 頁面呼叫並傳遞任何物件
不受跨網域安全性的限制