21 Replies Latest reply: May 25, 2012 3:22 PM by marciohdantas2012 RSS

    BUG: navigateToUrl always opens new tab in browser, also when window parameter is specified

    Karel VDH

      I have a problem navigating to a Url in the default browser in an Adobe Air project.

       

      air.navigateToUrl(request, windowName) launches the browser and displays the page, but it displays a new tab for every request.

       

      Here is a very simple example that shows the problem:

       

      Flex:

       

      <?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">

      <fx:Script>

      <![CDATA[

      import flash.display.Sprite;

      import flash.net.navigateToURL;

      import flash.net.URLRequest;

       

      protected function button1_clickHandler(event:MouseEvent):void

      {

      NavigateToURLExample();

      }

       

      public function NavigateToURLExample():void {

      var url:String = "http://www.adobe.com";

      var request:URLRequest = new URLRequest(url);

      try {           

      navigateToURL(request, "testWindow");

      }

      catch (e:Error) {

      // handle error here

      }

      }

      ]]>

      </fx:Script>

      <fx:Declarations>

      </fx:Declarations>

      <s:Button x="169" y="165" label="Button" click="button1_clickHandler(event)"/>

      </s:WindowedApplication>

       

       

      HTML:Javascript:

       

      <html>

          <head>

              <title>navigateToURLTest</title>

              <script type="text/javascript" src="lib/air/AIRAliases.js"></script>      

          </head>

          <body>    

              <a href="#" target="testp"  onclick="javascript:air.navigateToURL(new air.URLRequest('http://www.adobe.com'), 'TestWindow');return false;">Same Tab</a>

          </body>

      </html>

       

       

      How can I open the url in the same window/tab?

       

      Message was edited by: Karel VDH