1 Reply Latest reply on Jun 27, 2012 6:48 AM by Umal Kumar

    HTMLLoader window.open is not working

    nITiNkIlLeRmEeRuT Level 1

      Hi frnds,

       

      I have a web project developed in Flex which I have to make work standalone using AIR.

       

      I created Air project and loaded the web application using flash.html.HTMLLoader.

      The content is loading fine and working.

       

      There are few buttons which open different links using javascript functions window.open.

       

      The links are not opening. The javascript function is getting called using ExternalInterface and I placed alerts in that which is displaying.

       

      The function contains simple window.open

       

      [PHP]window.open("http://www.google.co.in","Google");[/PHP]

       

      I tried several solutions mentioned but none of them are working.

       

      [url]http://digitaldumptruck.jotabout.com/?p=672[/url]

      [url]http://soenkerohde.com/2008/09/air-html-with-_blank-links/[/url]

      [url]http://cookbooks.adobe.com/index.cfm?event=showdetails&postId=9243[/url]

       

      Kindly provide any assistance for this.

        • 1. Re: HTMLLoader window.open is not working
          Umal Kumar Adobe Employee

          I created a small application and I am able to use the window.open in the new window in default browser of the system.

           

           

          <?xml version="1.0" encoding="utf-8"?>

          <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                  xmlns:s="library://ns.adobe.com/flex/spark"

                  xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" creationComplete="windowedapplication1_creationCompleteHandler(event)">

          <fx:Script>

            <![CDATA[

             import mx.containers.Panel;

             import mx.core.IVisualElement;

             import mx.events.FlexEvent;

            

             protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void

             {

              // TODO Auto-generated method stub

              var urlReq:URLRequest = new URLRequest("test.html");

              html.htmlLoader.navigateInSystemBrowser = true;

              html.htmlLoader.load(urlReq);

             }

            

            ]]>

          </fx:Script>

          <fx:Declarations>

          </fx:Declarations>

          <mx:HTML id="html"/>

           

          </s:WindowedApplication>

           

           

          test.html

           

          <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
          <title>My Test Page</title>

          <script type="text/javascript">
            window.open("http://www.adobe.com");
          </script>

          </head>
          <body>

          <h2>Hello Welcome</h2>
          </body>
          </html>

           

          Let me know if this worked.