Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi,
I tested this also in an Air Flex application - I updated the original post accordingly.
The same problem occurs in FLex.
Does anyone have a workaround?
I must open the web page in the default browser, in the same tab.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Thank you very much Chris,
I was on a holiday and was not able to reply earlier. Sorry for that.
This is for a high profile Belgian company and I really need this to get working.
Copy link to clipboard
Copied
Hi Chris,
I posted a bug.
Any news on from you collegues?
Kind regards,
Karel
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi Junji,
Thank you for your post.
I'm working in Air, so I there is no hosting page.
I tried launching from Actionscript in Air, but that doesn't work either.
kind regards,
Karel
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi Marcio,
I was not able to find a work around. I didn't receive updates on the issue from Adobe either.
Cheers,
Karel
Copy link to clipboard
Copied
Was there a bug entered? I'd be happy to look up the status.
Chris
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi Chris,
Last June you replied to me :
>>Nothing yet but I'll forward along to the team that triages these bugs and see if they can take a look.<<
Since then no news.
Kind regards,
Karel
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi,
@Marcio, when you open the new bug, can you add a comment explaining that it is NOT a browser configuation issue as this is not the documented behaviour and it differs from standard JavaScript behaviour.
THanks,
Karel
Copy link to clipboard
Copied
I do agree that whatever the outcome, the documentation should be improved here.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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