检测Flash中的allowNetworking参数

发布于 2024-11-09 10:14:51 字数 518 浏览 3 评论 0 原文

您好,

这是关于 Flash 安全/沙箱问题。我想知道是否有办法让加载的 Flash .swf 对象知道是否为它设置了 allowNetworking="internal" ,可能使用 ActionScript(2.0 或 3.0)。

我找到了解决方案,但是它不区分限制是来自 allowNetworking 还是 allowScriptAccess 设置。

我并不是特别寻找解决方法(尽管这也很有趣),但只是为了能够检测是否专门将allowNetworking设置为“内部" 或至少是 "all" 以外的内容。

干杯:)

Greetings,

This is regarding a Flash security/sandbox issue. I was wondering if there was a way for the loaded Flash .swf object to know whether allowNetworking="internal" is set for it, possibly using ActionScript (2.0 or 3.0).

I found a solution, but it does not differentiate whether the restrictions are from allowNetworking or allowScriptAccess settings.

I am not particularly looking for a work around (although that would be interesting too), but just to be able to detect whether specifically allowNetworking is set to "internal" or at least something other than "all".

Cheers :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断爱 2024-11-16 10:14:51

您可以通过尝试执行特定的受限 API 并查看是否引发 SecurityError 来测试网络 API 限制。

public static function getNetworkingRestriction():String {

            var result:String = "all"; // default level

            try {
                // first try SharedObject.  If it throws a SecurityError, then allowNetworking="none"
                SharedObject.getLocal("test"); 

                try {
                    // SharedObject didn't throw a SecurityError. 
                    //If ExternalInterface.call() throws a SecurityError then allowNetworking="internal"
                    ExternalInterface.call(""); 
                }
                catch (e:SecurityError) {
                    result = "internal";
                }

            }
            catch (e:SecurityError) {
                result = "none";        
            }

            return result;

        }

可以找到受限网络 API 的列表 此处

You can test for the networking API restrictions by trying to execute specific restricted APIs and seeing if a SecurityError is thrown.

public static function getNetworkingRestriction():String {

            var result:String = "all"; // default level

            try {
                // first try SharedObject.  If it throws a SecurityError, then allowNetworking="none"
                SharedObject.getLocal("test"); 

                try {
                    // SharedObject didn't throw a SecurityError. 
                    //If ExternalInterface.call() throws a SecurityError then allowNetworking="internal"
                    ExternalInterface.call(""); 
                }
                catch (e:SecurityError) {
                    result = "internal";
                }

            }
            catch (e:SecurityError) {
                result = "none";        
            }

            return result;

        }

A list of the restricted networking APIs can be found here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文