LauncherOptions.FallbackUri | fallbackUri property

Applies to Windows and Windows Phone

Gets or sets a value that represents a URI that the user should be taken to in the browser if no app exists to handle the file type or URI.

Syntax


var fallbackUri = launcherOptions.fallbackUri;
launcherOptions.fallbackUri = fallbackUri;

Property value

Type: Windows.Foundation.Uri [JavaScript] | System.Uri [.NET] | Windows::Foundation::Uri [C++]

URI that the user should be taken to in the browser.

Remarks

You can only set the fallback URI property with http:// or https:// URI. If this property is set and there is no app installed to handle the file or URI being launched, the user's default browser is launched automatically and navigated to the specified URI. The user will not see an Open With dialog asking to choose an option in this case. You should only use the fallback URI when directing the user to the Windows Store is not appropriate, such as the case when the file or URI is only supported by a desktop app that is not listed on the Store. In all cases where there is an app on the Windows Store that supports the file or URI that you are launching, you should use the PreferredApplicationPackageFamilyName and PreferredApplicationDisplayName to recommend that app to the user.

Note  You cannot set the preferred application properties and the fallback URI at the same time, since only one fallback may be used. The Launcher API will fail if both fallbacks are set.

Windows 8.1:  In Windows 8.1, this property also accepts Windows Store URIs. These URIs can be used as an alternative to the PreferredApplicationPackageFamilyName and PreferredApplicationDisplayName properties to send the user to a specific app in the Store without popping an Open With dialog.

Examples

Call the Launcher.LaunchFileAsync(IStorageFile, LauncherOptions) | launchFileAsync(IStorageFile, LauncherOptions) method with fallbackUri set to the fallback URI.


// The URI to launch
var uriToLaunch = "contoso:somearguments";

// Create a Uri object from a URI string 
var uri = new Windows.Foundation.Uri(uriToLaunch);

// The fallback URI
var uriFallback = "http://www.contoso.com/somearguments";

// Create a Uri object from a URI string 
var fallbackURI = new Windows.Foundation.Uri(uriFallback);

// Set the fallback URI
var options = new Windows.System.LauncherOptions();
options.fallbackUri = fallbackURI;

Windows.System.Launcher.launchUriAsync(uri, options).then(
   function (success) {
      if (success) {
         // URI launched
      } else {
         // URI launch failed
      }
   });


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.System
Windows::System [C++]

Metadata

Windows.winmd

See also

LauncherOptions
Samples
Association launching sample
Tasks
How to launch the default app for a file (JavaScript)
How to launch the default app for a file (C#/VB/C++)
How to launch the default app for a URI (JavaScript)
How to launch the default app for a URI (C#/VB/C++)
Guidelines
Guidelines and checklist for file types and URIs
Reference
Launcher.LaunchFileAsync(IStorageFile, LauncherOptions)
Launcher.LaunchUriAsync(Uri, LauncherOptions)

 

 

Show:
© 2014 Microsoft. All rights reserved.