locked
Linking Directly to Website from Charm Settings Pane

    Question

  • Can I link directly to a website via the charm bar settings pane without opening a page within the application that contains an IFRAME?
    • Edited by j_83 Tuesday, June 26, 2012 3:34 PM
    Tuesday, June 26, 2012 3:27 PM

Answers

  • Oh..now I think I understand what you are trying to do.  Instead of window.load(""),  you can try this for launching the browser:

    var uri = new Windows.Foundation.Uri("http://www.yoururl.com");
    Windows.System.Launcher.launchUriAsync(uri);


    Dave Paquette @Dave_Paquette www.davepaquette.com

    • Marked as answer by Dino He Tuesday, July 3, 2012 9:16 AM
    Thursday, June 28, 2012 4:19 PM

All replies

  • I don't think that is possible.  The settings page must navigate to a page within your application.  You will probably need to build a simple page in your application that makes a web request and injects the content into you page.

    Something along the lines of:

    var resDiv = document.getElementById('resDiv');
    WinJS.xhr({ url: "http://www.microsoft.com" }).done(
        function fulfilled(result) {
            if (result.status === 200) {
                resDiv.innerHtml = result.responseText;
            }
        });


    Dave Paquette @Dave_Paquette www.davepaquette.com


    Tuesday, June 26, 2012 5:46 PM
  • You have to open a local page from your app to show the settings, but the content within them does not have to be in an iframe.  On that page you can simply have some text and then a link to your online site.

    There is an example of this in the settings sample: http://code.msdn.microsoft.com/windowsapps/App-settings-sample-1f762f49.  See the 'help' example in that sample project.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, June 26, 2012 6:49 PM
  • Thanks, we were mainly trying to have a browser window appear when clicking on a link the settings pane immediately (without loading an in app page).  For now i've created a page within the app and used a window.load("http://www.myurl.com") in that page to start the browser instance.  It's a bit clunky, and only works once currently.  I'll keep you updated.
    Wednesday, June 27, 2012 2:45 PM
  • Oh..now I think I understand what you are trying to do.  Instead of window.load(""),  you can try this for launching the browser:

    var uri = new Windows.Foundation.Uri("http://www.yoururl.com");
    Windows.System.Launcher.launchUriAsync(uri);


    Dave Paquette @Dave_Paquette www.davepaquette.com

    • Marked as answer by Dino He Tuesday, July 3, 2012 9:16 AM
    Thursday, June 28, 2012 4:19 PM