locked
How to launch Metro IE from Metro App RRS feed

  • Question

  • I want to have the user click on a hyperlink button and launch the Metro IE to navigate to a url. I'm missing something in the API, because I'm not seeing how to do this. Is this supported? Or is there a more generic approach where you just tell Windows API to open the link and it determine's how the user wants me to open it? Help please.
    Friday, September 16, 2011 3:46 AM

Answers

  • Yes - just indirectly.  You need to handle Click and then manually launch the browser using:

    Windows.System.Launcher.LaunchDefaultProgram(new Uri(yourLink));
    

    Joe

     

    Friday, September 16, 2011 4:05 AM

All replies

  • Yes - just indirectly.  You need to handle Click and then manually launch the browser using:

    Windows.System.Launcher.LaunchDefaultProgram(new Uri(yourLink));
    

    Joe

     

    Friday, September 16, 2011 4:05 AM
  • Thanks Joe, that worked perfectly.
    Sunday, September 18, 2011 3:21 PM
  • In the RTM tools the API has changed, for Windows Store metro apps the following code is necessary:

    using Windows.System;
    
    ...
    
            /// <summary>
            /// Displays the privacy policy in the browser.
            /// </summary>
            public async void ShowPrivacyPolicy()
            {
                await Launcher.LaunchUriAsync(new Uri("http://www.mywebserver.com/MyPrivacyPolicyPath"));
            }
    

    Also weird was that unless I added "Windows.System" with a using statement it did not resolve the Launcher class. This was on a clean Win8 Pro OS and VS2012 build I just installed.


    Key Artefacts

    Thursday, October 25, 2012 11:03 PM