flex player Controlling access to scripts in a host web page
Outbound scripting is achieved through use of the following ActionScript 3.0 APIs:
- The flash.system.fscommand() function
- The flash.net.navigateToURL() function (when specifying a scripting statement, such as navigateToURL("javascript: alert('Hello from Flash Player.')")
- The flash.net.navigateToURL() function (when the window parameter is set to "_top", "_self", or "_parent")
- The ExternalInterface.call() method
For SWF files running locally, calls to these methods are successful only if the SWF file and the containing web page (if there is one) are in the local-trusted security sandbox. Calls to these methods fail if the content is in the local-with-networking or local-with-filesystem sandbox.
The AllowScriptAccess parameter in the HTML code that loads a SWF file controls the ability to perform outbound scripting from within a SWF file.
Set this parameter in the HTML code for the web page that hosts a SWF file. You set the parameter in the PARAM or EMBED tag.
The AllowScriptAccess parameter can have one of three possible values: "always", "sameDomain", or "never":
- When AllowScriptAccess is "sameDomain", outbound scripting is allowed only if the SWF file and the web page are in the same domain. This is the default for AVM2 content.
- When AllowScriptAccess is "never", outbound scripting always fails.
- When AllowScriptAccess is "always", outbound scripting always succeeds.
If the AllowScriptAccess parameter is not specified for a SWF file in an HTML page, it defaults to "sameDomain" for AVM2 content.
Here is an example of setting the AllowScriptAccess tag in an HTML page:
The AllowScriptAccess parameter can prevent a SWF file hosted from one domain from accessing a script in an HTML page that comes from another domain. Using AllowScriptAccess="never" for all SWF files hosted from another domain can ensure the security of scripts located in an HTML page.
For more information, see the following entries in the ActionScript 3.0 Language and Components Reference:
- The flash.system.fscommand() function
- The flash.net.navigateToURL() function
- The call() method of the ExternalInterface class
11:39 AM
|
Labels:
Flex Player Security
|
This entry was posted on 11:39 AM
and is filed under
Flex Player Security
.
You can follow any responses to this entry through
the RSS 2.0 feed.
You can leave a response,
or trackback from your own site.
0 comments:
Post a Comment