例如,当 html 文件和 swf 文件都使用 file:
协议(protocol)时,我尝试从 actionscript 执行类似 window.alert
的函数.
有人知道有什么方法可以做到这一点吗?
无需更改全局闪存安全设置
最佳答案
看完 Controlling access to scripts in a host web page 貌似不行.
For SWF files running locally, calls to these APIs 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.
然后this page在本地沙箱上基本上说除非 swf 位于用户或安装程序需要将其放入的“本地受信任的沙箱”中,否则它将无法工作。
This blog post关于“本地文件系统沙箱”说:
First, I think the documentation here is a bit too generous. SWFs loaded from the local file system do face some restrictions. The most relevant restrictions are probably:
- The SWF cannot make a call to JavaScript (or vbscript), either through URL or ExternalInterface
- The SWF cannot call a HTTP or HTTPS request.
- Querystring parameters (ex. Blah.php?querystring=qs-value) are stripped and will not be passed (even for requests to local files)
关于javascript - 有没有办法用本地内容从actionscript执行js函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5280656/