Reputation: 1014
I need my swf to be able to see the domain of the page that it's loaded on. Normally to to this I would just look at window.location over ExternalInterface, but in this particular case the swf is going to be embedded with allowscriptaccess="never", so that's not going to work. Is there an actual api that will give me that or do I have to resort to ugly hacks?
Upvotes: 2
Views: 1413
Reputation: 5220
Actionscript 3 actually has a property you can query straight, in flash.system.Security
(http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Security.html#pageDomain), like so:
import flash.system.Security;
...
var domain:String = Security.pageDomain;
It will give you "[t]he domain portion of the HTML page containing the swf."
Upvotes: 2
Reputation: 1014
It turns out that there's no direct way to do this. However, you can do the following:
In order to prevent this value from being forged (by people linking directly to the static file server, skipping the redirect) you have to have your static file server verify that the value of the get variable is the same as the value in the referer header before serving the file (which I know you can do in nginx).
Upvotes: 0