Greetings to all
What is a Policy File ?
A
Policy File is a simple
XML that contains a list of ?trusted? domains.
It allows to
access the data in format XML from the domain in which the SWF resides to other domains declared in the Policy File.
Let us make an example?
Let us suppose to have a SWF on domain1.com that loads the data from an XML file.
Let us suppose that we want to use the same XML file from another SWF which is on domain2.com.
Naturally, for security purpose, this sharing is not possible.
The solution is to create a Policy File that allows the so-called cross-domain and to add a file in the root of domain1.com which will pass the authorization to domain2.com to upload the data found on the XML file.
Let us see how to create a Policy File?
To create a Policy File is very simple and only requires 3 steps:
- to create a new XML file
- to add a list (or even a single one) of domains to which we want to allow the access using the official Adobe syntax
- to save the file as crossdomain.xml
This is an example of a Policy File:
HTML Code:
<?xml version="1.0" encoding="macintosh"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="dominio2.com" />
</cross-domain-policy>
Obviously, instead of domain2.com you need to insert the name of the domain to which you want to allow the access to the XML files found on your domain.
Next, you add the crossdomain.xml file to the root of domain1.com.
This way, an SWF on domain2.com can access the XML files which are placed in domain1.com.
See you next !