簡體   English   中英

為什么flash只阻止我在一個案例中加載跨域swf?

[英]Why does flash block me from loading a cross domain swf only in one case?

這有效:

OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at https://foo.com/flash/flash.swf by requestor from http://bar.com/flash/old.swf
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at https://foo.com/flash/flash.swf by requestor from http://bar.com/flash/old.swf
OK: Policy file accepted: https://foo.com/crossdomain.xml
OK: Request for resource at https://foo.com/flash/flash.swf by requestor from http://bar.com/flash/old.swf is permitted due to policy file at https://foo.com/crossdomain.xml

這失敗了:

OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at
    https://foo.com/flash/flash.swf
     by requestor from http://bar.com/flash/new.swf
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at
    https://foo.com/flash/flash.swf
     by requestor from http://bar.com/flash/new.swf
Warning: [strict] Policy file requested from
    https://foo.com/crossdomain.xml redirected to https://foo.com/crossdomain.xml; will use final URL in determining scope.  See http://www.adobe.com/go/strict_policy_files if this causes problems.
OK: Policy file accepted: https://foo.com/crossdomain.xml
Error: Request for resource at
    https://foo.com/flash/flash.swf
     by requestor from http://bar.com/flash/new.swf is denied due to lack of policy file permissions.

我能找到的唯一區別是:

1)不同的“來自”swf文件,但不應該改變任何東西

2)new.swf嘗試的奇怪的重定向警告

foo.com的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="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
</cross-domain-policy>

我的舊swfs和新swfs都使用此代碼加載第三方swf:

var strURL:String = this.videoParameters.media_url;
// replace [timestamp]
strURL = strURL.replace(
    "[timestamp]", 
    (new Date()).valueOf().toString()
);
// use LoaderContext for domain security
this._oSWFApplicationDomain = new ApplicationDomain();
var oContext : LoaderContext = new LoaderContext(
    false, 
    this._oSWFApplicationDomain, // ApplicationDomain must be separate
    SecurityDomain.currentDomain
    );

this._oSWF = new Loader();

var oLoader:LoaderInfo = this.oSWF.contentLoaderInfo;

// start media load timeout
this._oManager.startMediaTimer();

// listen for when the SWF completely loads itself
oLoader.addEventListener(
    Event.COMPLETE, 
    this.onLoadComplete,
    false,
    0,
    true
); 

// listen for any error that may occur while trying to load
oLoader.addEventListener(
    IOErrorEvent.IO_ERROR, 
    this.onLoadError,
    false,
    0,
    true
);

var oURLRequest : URLRequest = new URLRequest(strURL);

this.oSWF.load(oURLRequest, oContext);

問題可能是由於您加載的SWF的源URL中有一些空格。 無論是在開頭還是結尾,都不確定是哪個問題,但這會導致flash加載crossdomain.xml然后出現安全錯誤。 是的閃光燈。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM