/ Published in: JavaScript
There are many ways to deliver a crossdomain.xml file through NodeJS or Express.js. Here is one solution
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
app.get( "/crossdomain.xml", onCrossDomainHandler ) function onCrossDomainHandler( req, res ) { var xml = '<?xml version="1.0"?>\n<!DOCTYPE cross-domain-policy SYSTEM' + ' "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">\n<cross-domain-policy>\n'; xml += '<allow-access-from domain="*" to-ports="*"/>\n'; xml += '</cross-domain-policy>\n'; req.setEncoding('utf8'); res.writeHead( 200, {'Content-Type': 'text/xml'} ); res.end( xml ); }