CanLaunchURL failing to return correct values

Hi,

I’m not sure if this is a bug or if I’m not using/understanding CanLaunchURL correctly. Basically my understanding would be that the engine checks if the URL is accessible on the web and returns a true or false depending on whether it can access it or not.

What I’m seeing however is that if I use “FGenericPlatformProcess::CanLaunchURL” then it always returns False even with a valid URL, and if I use “UKismetSystemLibrary::CanLaunchURL” as in the example below it always returns True even with an Invalid URL.

Here is how I have the check setup currently:

//Invalid URL epicgames2.com - checked in web browser, definitely invalid, but engine returns True/Valid.
if (UKismetSystemLibrary::CanLaunchURL(TEXT("https://www.epicgames2.com")))
{
	FPlatformProcess::LaunchURL(TEXT("https://www.google.com"), NULL, NULL);
}
else
{
        FPlatformProcess::LaunchURL(TEXT("https://www.epicgames.com"), NULL, NULL);
}

Is this the correct way of both doing it (I’m not that great with C++) and is my understanding of what CanLaunchURL does correct?

Thanks.

EDIT: Having now seen the new submission process for bug reports I’ve now submitted this through the bug report form. Still happy for advice here though from anyone who may have a clue to what’s going on :slight_smile:

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://forums.unrealengine.com/unreal-engine/announcements-and-releases/1410408-unreal-engine-bug-submission-form

Thanks

Hello,

Thank you for using the new bug submission form to report this issue. I have entered UE-54069 for part of the behavior that you described. Normally we would not also respond to an AnswerHub post, but I wanted to briefly discuss the other part of your report.

The reason that FGenericPlatformProcess::CanLaunchURL() always returns false is because that is a generic implementation of the function that is only used if a particular platform does not have an implementation of the function. Calling the FGenericPlatformProcess version directly will only result in a message being printed to the log that the function is not implemented on the platform, and will always return false. You will want to make sure to instead call the UKismetSystemLibrary version of the function, which will use the appropriate implementation for the platform you are using. Unfortunately, it does not look like the current implementation for Windows matches what the function appears to be intended to do.