Skip navigation
Karel VDH
Currently Being Moderated

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

May 11, 2011 4:12 PM

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

 
Replies
  • Currently Being Moderated
    Jun 6, 2011 9:18 AM   in reply to Karel VDH

    Hi..

     

    I am struck with the same issue as well.

    It works for few sites like "http://www.adobe.com" and "http://www.google.com", but most of the sites open up in a new window, even if I specify custom name, like:

    navigateToURL(new URLRequest("http://www.britishairways.co.uk"), "MyWindow");

     

    Also tried through ExternalInterface viz:

    ExternalInterface.call("window.open", new URLRequest("http://www.britishairways.co.uk"), "MySameWindow", "");

     

    Please reply whether it is a bug, or there if there are any alternative approaches.

     
    |
    Mark as:
  • Chris Campbell
    9,456 posts
    May 4, 2010
    Currently Being Moderated
    Jun 8, 2011 10:48 PM   in reply to PreePrave

    I'll ask around about this behavior and see if I can get additional info.  In the meantime, would you mind creating a new bug on our online bug database?  Please post back with a URL so others can comment and add their votes.

     

    Thanks,
    Chris

     
    |
    Mark as:
  • Chris Campbell
    9,456 posts
    May 4, 2010
    Currently Being Moderated
    Jun 13, 2011 4:04 PM   in reply to Karel VDH

    Karel,

    Nothing yet but I'll forward along to the team that triages these bugs and see if they can take a look.

     

    Thanks,
    Chris

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 29, 2011 1:55 AM   in reply to Karel VDH

    Hello All,

     

    I am able to open pdf using navigateToURL method.

    But the title of the web page/tab shows the entire url... is there any way to change the title of the page/tab to something else?

     

    any help is appreciated

     

    Thanks

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 29, 2011 1:56 AM   in reply to Chris Campbell

    Hello All,

     

    I am able to open pdf using navigateToURL method.

    But the title of the web page/tab shows the entire url... is there any way to change the title of the page/tab to something else?

     

    any help is appreciated

     

    Thanks

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 7, 2011 6:27 PM   in reply to Karel VDH

    I have seomthing like this inside a class or package

     

    function foo(event:MouseEvent):void
                {
                    var result:String = ExternalInterface.call("callHome");
                    var fooURL:URLRequest = new URLRequest(result);
                    navigateToURL(fooURL, "_self");
                }
               
                logoButton.addEventListener(MouseEvent.CLICK, foo);

     

    and this on every html page

     

    <script type="text/javascript">
    function callHome(){
       
        return "http://localhost/fooproject/index.html";
    }

     

    This is a flash button of course I am not sure if it helps, but this worked out for me.

     
    |
    Mark as:
  • Currently Being Moderated
    May 18, 2012 8:46 AM   in reply to Karel VDH

    Hi Karel,

     

    I know this post is kind of old, but were you able to find a workaround? I'm having the exactly same problem in Adobe AIR.

     

    Thanks,

    Marcio

     
    |
    Mark as:
  • Chris Campbell
    9,456 posts
    May 4, 2010
    Currently Being Moderated
    May 21, 2012 3:14 PM   in reply to Karel VDH

    Was there a bug entered?  I'd be happy to look up the status.

     

    Chris

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2012 3:45 PM   in reply to Chris Campbell

    Thanks for your reply Karel!

     

    Hi Chris,

     

    I found this bug report made by Karel last year (https://bugbase.adobe.com/index.cfm?event=bug&id=2895041) Bug 2895041, but unfortunately, it was closed as not an AIR SDK issue.

    I read Ru Wan's note, but in my opinion, that's not exactly the case. The navigateToUrl function should work exactly as a normal javascript 'window.open' - that's open in a new window if I specify '_blank' or in a specific window if the second parameter is saying so. Maybe you could reopen this issue.

     

    Thanks in advance for your help.

    Marcio

     
    |
    Mark as:
  • Chris Campbell
    9,456 posts
    May 4, 2010
    Currently Being Moderated
    May 23, 2012 12:37 AM   in reply to Karel VDH

    I'd recommend opening a new bug and try stating your case again. From what I've read, Ru's statement that this is a configuration preference of the browser appears to be correct.  Regardless, if you do open a but It would really help if Karel and others affected take a minute vote for the bug and add their comments.

     
    |
    Mark as:
  • Chris Campbell
    9,456 posts
    May 4, 2010
    Currently Being Moderated
    May 23, 2012 4:40 PM   in reply to Karel VDH

    I do agree that whatever the outcome, the documentation should be improved here.

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2012 6:29 AM   in reply to Chris Campbell

    Chris,

     

    I added a note to the bug report. Should I create a new report or the note on the closed one is fine?

     

    Thanks,

    Marcio

     
    |
    Mark as:
  • Chris Campbell
    9,456 posts
    May 4, 2010
    Currently Being Moderated
    May 25, 2012 1:42 PM   in reply to marciohdantas2012

    I suspect you'll get better visibility on a new bug report.  I'd references both this post and the closed bug, again making your case why you think it was closed erroneously.

     
    |
    Mark as:
  • Currently Being Moderated
    May 25, 2012 3:22 PM   in reply to Chris Campbell

    Hi Chris and Karel,

     

    I opened a new bug report there - https://bugbase.adobe.com/index.cfm?event=bug&id=3199139

    I think it may help if others could vote there or add notes.

     

    Thanks,

    Marcio

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points