Can’t see cross-domain images in your Flash file? Make a crossdomain.xml

| geek

My mom recently noticed that images weren’t loading in the Flash viewer on www.adphoto.com.ph, but they were loaded on adphoto.com.ph. A quick look at the Javascript console showed that crossdomain.xml was missing. The Macromedia Flash 10 plugin is stricter about this than previous versions were, so if you don’t have a crossdomain.xml set up, you might find your older sites breaking for new browsers.

Here is a straightforward crossdomain.xml that allows requests from everywhere, useful for development:

<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

You can specify domains like this:

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

More information: http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html

When debugging a website, it is often helpful to use Chrome or Firefox’s developer tools, such as the Javascript console. In this case, the request for crossdomain.xml and the resulting 404 (not found) helped me find out what was going on.

2011-03-08 Tue 08:01

You can comment with Disqus or you can e-mail me at sacha@sachachua.com.