打开网页出现“安全沙箱冲突”的提示
文章轉(zhuǎn)自網(wǎng)絡(luò):
為了滿足安全要求,Flash在它的AS3.0里提出了安全沙箱這一概念,在未經(jīng)授權(quán)的情況下,Flash默認是不允許進行跨域通信的,這樣使得Flash的安全可靠性得到了提高,同時也帶來了一些問題。
解決“安全沙箱”問題的方法,如果你是在制作和在網(wǎng)頁上發(fā)布flash,所需要的是調(diào)整flash參數(shù)allowScriptAccess的值改為always,如<param name="allowScriptAccess" value="always" />,還有一種是說設(shè)置安全站點;但就普通用戶而不是開發(fā)者而言,處理此類flash安全沙箱問題,直接的方法就是重新安裝flash插件:可以先進入控制面板-添加刪除程序,卸載原有的flash插件,再到www.adobe.com官方網(wǎng)站下載安裝新版的flash插件,或者直接去相應(yīng)網(wǎng)站,如在線視頻網(wǎng)站,自動安裝對應(yīng)插件。
http://www.adobe.com/go/strict_policy_files_cn 以解決此問題。
A:策略文件有錯誤 CrossDomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy> <site-control permitted-cross-domain-policies="all" />
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
PS:加載方式 Security.loadPolicyFile("http://myDomain/crossdomain.xml");
策略文件放在被加載者服務(wù)器根目錄(在提供數(shù)據(jù)的站點放入一個crossdomain.xml文件)
個人理解:所有網(wǎng)絡(luò)上的資源除非是服務(wù)器限制,我們都可以加載,只是無法對其進行數(shù)據(jù)的操作,如果需要操作這些數(shù)據(jù),就需要在服務(wù)器上放置策略文件。(eg:如果需要對圖片進行像素級操作,那就在服務(wù)器上放策略文件)
再次PS:如果策略文件不在根目錄,需要用 Security.loadPolicyFile(filepath); 方法加載安全策略文件
//++++++++++++++++++++++++++++ 對加載者進行權(quán)限操作 (applicationDomain)
SecurityError: Error #2119: 安全沙箱沖突:調(diào)用者 http://cs4165.vkontakte.ru/[[IMPORT]]/xn.smoothfish.cn/fish_xn/main.swf?lang=ru&pid=0&apiID=1716287&mode=0&version=2027 不能訪問 http://xn.smoothfish.cn/fish_xn/items.swf 擁有的 LoaderInfo.applicationDomain。
at flash.display:loaderInfo/get applicationDomain()
at cafe.util::CClass$/getClass()
at cafe.map::CLayerLoading/showCookResLoading()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at cafe.main::main/getResLoading()
at cafe.main::main/loadCompleteHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at cafe.load::CLoad/load()
at cafe.load::CLoad/loadStartHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at cafe.load::CLoad/loaderCompleteHandler3()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at cafe.load::CLoadAbstract/finish()
at cafe.load::CLoadConfig/loadConfigHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
在被加載者SWF內(nèi)寫入
Security.allowDomain("*");// 注意,"www.baidu.com" 和 "baidu.com"不是相同域,多個域 用逗號隔開
PS:security.allowDomain ("*") 與跨域加載資源其實是兩回事
有security.allowDomain ("*")標注的Flash文件 只表示成功加載此的容器可以對它進行所有權(quán)限的操作
//++++++++++++++++++++++++++++
//為true的時候,先下載策略文件( 指定 Flash Player 在加載對象前是否應(yīng)檢查跨域策略文件是否存在)
var lcoaderContext = new LoaderContext(true);
//var loadercontexoaderContext = new LoaderContext(false, new ApplicationDomain(), SecurityDomain.currentDomain);
var context:LoaderContext = new LoaderContext();
context.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
context.securityDomain = SecurityDomain.currentDomain;
loader.load(url,context);
//++++++++++++++++++++++++++++
解決flash安全沙箱的幾種方法總結(jié)
1。配置跨域文件來實現(xiàn)
System.security.allowDomain("www.baidu.com", "baidu.com", "mp3.baidu.com");
2。利用JS腳本繞過安全沙箱(有待驗證)
<param name="allowScriptAccess" value="always" />
3。使用Asp.Net繞過As3的跨域安全沙箱完全的文件轉(zhuǎn)發(fā),以極低的效率來解決了問題,基本無實用價值
4。本地安全沙箱:在C:\windows\system32\Macromed\Flash\FlashPlayerTrust 下面,添加一個txt文件,例如songhuan .txt,然后在里面添加你的本機的目錄,例如f:\crayon\或者c:\都可以。
轉(zhuǎn)載于:https://www.cnblogs.com/mikevictor07/archive/2012/10/08/2715699.html
總結(jié)
以上是生活随笔為你收集整理的打开网页出现“安全沙箱冲突”的提示的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 事件查看器 无法完成应用程序上的操作,接
- 下一篇: NodeBlog v0.1.0发布