JD Isaacks
JD Isaacks

Reputation: 57974

Adobe air... launch website but pick which browser?

OK I know that in Adobe Air you can call navigateToURL(new URLRequest(url)) and it will open the users default web browser to open the page.

Also now in AIR 2 you can launch any application.

So I am wondering if there is a way I can launch a particular browser to open a page in?

Upvotes: 4

Views: 1399

Answers (2)

JD Isaacks
JD Isaacks

Reputation: 57974

I it turns out with AIR 2 you can run command ling arguments so I was able to achieve what I wanted like so:

private function openApp():void
{
    if(NativeProcess.isSupported)
    {

        var file:File = File.userDirectory;
        file = file.resolvePath("AppData/Local/Google/Chrome/Application/chrome.exe");

        var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
        nativeProcessStartupInfo.executable = file;
        var process:NativeProcess = new NativeProcess();

        var args:Vector.<String> = new Vector.<String>();
        args.push("https://www.google.com");

        nativeProcessStartupInfo.arguments = args;

        process.start(nativeProcessStartupInfo);

    }
}

Upvotes: 4

JeffryHouser
JeffryHouser

Reputation: 39408

If you're using navigateToURL it, basically, passes the URL to the operating system and opens the default application for handling such requests. You can use navigateToURL to open word documents and other files too.

I was pretty sure that the NativeProcess features of AIR 2 allow you to launch applications, but I did not believe they allow you introspect the system to discover what browsers exist and where the DLL / EXE files are.

A good article on the native process stuff: http://www.adobe.com/devnet/air/flex/quickstart/interacting_with_native_process_02.html

Upvotes: 1

Related Questions