View Full Version : Problem opening links from remote website

05-11-2009, 07:28 PM
I have tried the example at :


<script src="AIRAliases.js" />
function init() {
var url = "http://www.mydomain.com/client.php";
var request = new air.URLRequest(url);

var addBridge = function(){
document.getElementById('child').contentWindow.parentSandboxBridge = interfaceObject;
window.runtime.trace('js bridge call');
<body onload='init()'>
<a href="#" id="child" onClick="clickButton();">link to open web browser</a>

But i can not seem to make links in html loaded from remote domain in mx:HTML component open a default browser.

Has anyone done this?This code is running in the html of the remote page loaded inside of the following air application.

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
showFlexChrome="false" showStatusBar="false" showGripper="true" showTitleBar="false"
width="408" height="710" frameRate="45"
horizontalScrollPolicy="off" verticalScrollPolicy="off"
xmlns:controlbar="com.xd.components.controlbars.*" viewSourceURL="srcview/index.html"

<mx:Style source="assets/dark_default.css" />

import flash.net.URLRequest;

public function clickButton():void{
var request : URLRequest = new URLRequest('http://www.mydomain.com/client.php');
navigateToURL(request )

private var testInterface:Object = new Object();

private function init():void
testInterface.clickButton = this.clickButton;

private function addBridgeObject():void
trace("Added bridge object");
html.domWindow.interfaceObject = testInterface;


<!-- Application Custom Chrome -->
<chrome:CustomChrome top="10" bottom="10" left="10" right="10" />

<!-- ContentBackgroundArea -->
<mx:VBox top="11" bottom="11" left="11" right="11" styleName="contentBackground" horizontalScrollPolicy="off" verticalScrollPolicy="off" >


<!-- ContentArea -->
<mx:Canvas visible="true" top="66" bottom="34" left="11" right="11" styleName="contentArea" horizontalScrollPolicy="off" verticalScrollPolicy="auto" >
<chrome:BorderHighlight top="0" bottom="0" left="0" right="0" />
<mx:Button click="clickButton()" />
<mx:HTML id="html" location="http://www.mydomain.com/client.php" htmlDOMInitialize="addBridgeObject()" width="100%" height="100%"/>

<!-- Application ControlBar -->

<!-- Application StatusBar -->
<chrome:StatusBar bottom="11" left="11" right="11" />


How can i get the links in the remote webpage to open the default system browser (firefox, IE, etc..) ?

I get the following error on line 7 of the loaded html page in the debugger.

TypeError: Undefined value

i think this means that the value is not defined? or cant access the function


Which is declared in the AIRAliases.js file for sure i checked.
also when clicking the hyper link in the page i get

ReferenceError: Can't find variable: clickButton