AS3 Cross-domain issues

Source: Internet
Author: User

What is cross-domain?

Cross-domain simply means that access to other domain names of files or resources, such as a.com Flash to access b.com resources, then will cause cross-domain problems, because a.com and B.Com are not the same domain name.

Why are there cross-domain issues?

In fact, not only flash,javascript and other scripts have cross-domain issues, this is mainly the security mechanism of their own decision, because cross-domain access to some files or resources is a certain risk, he exceeded the scope of the site itself, for the outside of the resources can not audit its security, In today's increasingly rampant network virus trojan, cross-domain restricted access is an important solution to its security policy.

Code processing methods:

Flash.system.Security.allowInsecureDomain ("*"); Allow Flash to access any URL resource, if you just want to access a specific URL, you can change the * to the URL, if more than one URL, separated by a comma, Note that Allowinsecuredomain is allowed to access URL resources with authentication, such as HTTPS, which is not required if you are only accessing normal HTTP.

If you want to read an external file, such as Swf,picture,mp3 and so on, then you need a cross-domain policy file (crossdomain.xml), which is actually an XML file, the specific content is:

The code is as follows Copy Code

<?xml version= "1.0"?>
<cross-domain-policy>
<allow-access-from domain= "www.explorechn.com"/>
<allow-access-from domain= "explorechn.com"/>
<allow-access-from domain= "223.4.119.191"/>
</cross-domain-policy>

This is the cross-domain policy file, allow-access-from domain represents the URL that is allowed to be accessed, if there are multiple additions, if all is allowed on a allow-access-from domain = "*".

AS3 Cross-domain issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.