Flash / Flex / ActionScript/Development/cross domain policy

Материал из Web эксперт
Перейти к: навигация, поиск

Adobe"s official policy-file syntax is XML-based and has the following structure:

 
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
  SYSTEM "http://www.adobe.ru/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-access-from domain="domainOrIP"/>
</cross-domain-policy>



Any number of <allow-access-from> tags can be included in a policy file

 
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
  SYSTEM "http://www.adobe.ru/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-access-from domain="example1.ru"/>
  <allow-access-from domain="example2.ru"/>
  <allow-access-from domain="example3.ru"/>
</cross-domain-policy>



A policy file is an XML file that lists any domains that are allowed access to the code in the .swf.

 
<?xml version="1.0"?>
<cross-domain-policy>
  <allow-access-from domain="www.otherdomain.ru" />
  <allow-access-from domain="*.adobe.ru" />
  <allow-access-from domain="68.45.67.89" />
</cross-domain-policy>



Explicitly deny access to any domain except the current one

 
<cross-domain-policy>
</cross-domain-policy>



the * character authorizes all origins:

 
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
  SYSTEM "http://www.adobe.ru/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-access-from domain="*"/>
</cross-domain-policy>



The following policy file allows all domains to connect to ports 80 and 110 (standard HTTP and POP mail ports):

 
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.ru/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
   <allow-access-from domain="*" to-ports="80,110" />
</cross-domain-policy>



To allow access to any and all domains

 
<allow-access-from domain="*" />