JavaScript Adobe AIR使用Sandbox Bridge打开新URL

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript Adobe AIR使用Sandbox Bridge打开新URL相关的知识,希望对你有一定的参考价值。

//This code is placed in the root document header
//This function is written to run from the sandbox. It opens a url in an external browser
function openExternalURL(href) {
    var request = new air.URLRequest(href);
    try {            
        air.navigateToURL(request);
    }
    catch (e) {
        // handle error here
    }
}

//Create an object that will be used to expose AIR functionality to the browser sandbox
var Exposed = new Object();

//Exposed can now be read from the sandbox, so can the above function. The open url
//function is added as a method of the exposed object.
Exposed.openExternalURL = openExternalURL;

function doLoad() {
    //Place the Exposed object on the parentSandboxBridge property of the ui frame's window object.
    var frame = document.getElementById('UI').contentWindow.parentSandboxBridge = Exposed;
}
//doLoad is placed inline on the body tag.

//Now to run the external function from inside the sandbox use. The function expects
//an argument that contains a URL.
parentSandboxBridge.openExternalURL(href);

以上是关于JavaScript Adobe AIR使用Sandbox Bridge打开新URL的主要内容,如果未能解决你的问题,请参考以下文章

Adobe AIR SDK 和 Flex SDK 的关系?

Adobe air(HTML + JS)阻止图像,输入和文本区域的右键单击事件

Adobe Air - 使用 Air 打开文件

linux adobe air 无法安装

Adobe Air .air文件:是32位,64位还是都不是?

Adobe AIR 代码签名证书使用指南