Website controls (cross-domain policy files)
To make data from a web server available to SWF files from other domains,you can create a cross-domain policy file on your server. A cross-domain policy file is an XML file that provides a way for the server to indicate that its data and documents are available to SWF files served from certain domains or from all domains. Any SWF file that is served from a domain specified by the server ’s policy file is permitted to access data or assets from that server. Cross-domain policy files affect access to a number of assets,including the following:
Data in bitmaps,sounds,and videos
Loading XML and text files
Access to socket and XML socket connections
Importing SWF files from other security domains into the security domain of the loading
SWF file
Policy file syntax
The following example shows a policy file that permits access to SWF files that originate from *.marciorosa.com ,www.friendOfMarciorosa.com and 192.0.34.166 :
<?xml version="1.0"?> <cross-domain-policy> <allow-access-from domain="*.marciorosa.com"/> <allow-access-from domain="www.friendOfMarcioRosa.com"/> <allow-access-from domain="192.0.34.166"/> </cross-domain-policy>
When a SWF file attempts to access data from another domain,Flash Player automatically ttempts to load a policy file from that domain.If the domain of the SWF file that is attempting to access the ata is included in the policy file,the data is automatically accessible.
By default,policy files must be named crossdomain.xml and must reside in the root directory of the server.However,a SWF file can check for a different name or in a different directory location by calling the Security.loadPolicyFile()method.A cross-domain policy file applies only to the directory from which it is loaded and to its child directories.Soa policy file in the root directory applies to the whole server,but a policy file loaded from an arbitrary subdirectory applies only to that directory and its subdirectories.
A policy file affects access only to the particular server on which it resides.For example,a policy file located at https://www.adobe.com:8080/crossdomain.xml will apply only to data-loading calls made to www.adobe.com over HTTPS at port 8080.
A cross-domain policy file contains a single
If you specify an IP address,access is granted only to SWF files loaded from that IP address using IP syntax (for example,http://65.57.83.12/flashmovie.swf ),not those loaded using domain-name syntax.Flash Player does not perform DNS resolution.
You can permit access to documents originating from any domain,as shown in the following example:
<?xml version="1.0"?> <!--http://www.marciorosa.com/crossdomain.xml --> <cross-domain-policy> <allow-access-from domain="*"/> </cross-domain-policy>
Each
If data to be loaded is on a HTTPS server,but the SWF file loading it is on an HTTP server, Adobe recommends that you move the loading SWF file to an HTTPS server so that you can keep all copies of your secure data under the protection of HTTPS.However,if you decide that you must keep the loading SWF file on an HTTP server,add the secure=”false” attribute to the allow-access-from>tag,as shown in the following code:
<allow-access-from domain="www.marciorosa.com"secure="false"/>A policy file that contains no