getURL not wokring for native

I have getURL not working on native targets with the latest OpenFL version.
And I think, I know why. :smile:
Any chance it to be fixed?

public static function getURL (request:URLRequest, target:String = null) {
        
        if (target == null) {
            
            target = "_blank";
            
        }
        
        #if (js && html5)
        Browser.window.open (request.url, target);
        #elseif flash
        return flash.Lib.getURL (request, target);
        #end
        
    }
1 Like

It’s simple on the desktop, but I don’t know why, but sys.io.Process doesn’t work as expected when there’s no console window, perhaps because shell commands aren’t executed the same outside of a shell :wink:

Some variant of this:

Would this work as a quick fix?

#if (js && html5)
Browser.window.open (request.url, target);
#elseif flash
return flash.Lib.getURL (request, target);
#elseif desktop
ProcessHelper.openURL (request.url);
#end

I think this won’t work without a shell window

When I tried it, it created a shell window temporarily (<1/2 second) to handle the command. Certainly not ideal, but it’s better than nothing.

Note: I’ve only tested it on Windows. Maybe I should have said “#elseif windows” rather than “#elseif desktop.”

How about Andoird and iOS?

If we can find a satisfactory answer for the desktop, adding iOS and Android will probably not be hard. It may all devolve into native code, but I hope not

Hello!

Was this problem ever fixed?
Another problem I have is with URLRequest, I’m getting “Problem with curl: 6”.
What is that?

No update, I can do “getURL” from a console, but in a window it opens a command-prompt and is not a good experience, open if people have other ideas, perhaps we need to go custom native code on this?

I’ve no idea how it works, but can we re-use the code from legacy?