1 Reply Latest reply on May 11, 2009 10:47 AM by soltrinox1

    Problem opening links from remote website


      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





        • 1. Re: Problem opening links from remote website
          soltrinox1 Level 1

          Set the navigateInSystemBrowser property of the HTMLLoader control on the creationComplete event of the HTML control.




          <?xml version="1.0" encoding="utf-8"?>
          <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
                      private function init():void
                            html.htmlLoader.navigateInSystemBrowser = true;
                <mx:HTML location="test.html" id="html" creationComplete="init()"/>


          Changes to the location property of the HTML control will now cause the link to open up in the system browser. The fix for that is to set the htmlLoader.navigateInSystemBrowser property to false, change location and then set it back to true.