locked
WinRT information: Access denied when trying to launch IE with Windows.System.Launcher.launchDefaultProgram(uri)

    Question

  • I am experiencing an issue when I want to launch IE after selecting search results from the search pane.

    Basically my app implements Search contract and on resultsuggestionchosen I want to launch IE with some custom URL. In result I am getting exception "WinRT information:  Access denied".  

    Interesting that if I try to call the same function from button click on the default.html page, it works. 

    This is my function:

    function launchIE(e) {

            var uri = new Windows.Foundation.Uri(e.url);

            Windows.System.Launcher.launchDefaultProgram(uri);  //this is where I got the exception.

        } 

     

    VS Output:

    'WWAHost.exe' (Script): Loaded 'Script Code (Windows Internet Explorer)'.

    JavaScript runtime error: Access is denied.

    WinRT information: Access is denied.

     

    Thanks

    Agris

    Friday, November 18, 2011 6:16 PM

Answers

  • It looks like the following seems to be working with Windows 8 RP and Visual Studio 2012 RC

    var uri = new Windows.Foundation.Uri(e.url);
    Windows.System.Launcher.launchUriAsync(uri);

    Saturday, June 02, 2012 10:08 PM

All replies

  • I think (but could be wrong) that they're trying to prevent apps from doing unwanted "pop-ups." The click operation works because the user took some direct action.

    Does the URL need to be Modern IE? Can you load the page you want in an iFrame inside your app? That might be a better experience for the user anyway.  


    Senior Dev for Windows Phone Services
    Friday, November 18, 2011 7:37 PM
  • I think (but could be wrong) that they're trying to prevent apps from doing unwanted "pop-ups." The click operation works because the user took some direct action.

    Does the URL need to be Modern IE? Can you load the page you want in an iFrame inside your app? That might be a better experience for the user anyway.  


    Senior Dev for Windows Phone Services
    Friday, November 18, 2011 7:38 PM
  • Thanks Bryan, 

    Iframe is not really an option, it has to open default web browser.

     

    Monday, November 21, 2011 9:57 AM
  • Agris,

    I saw a related thread that suggested that this will work if you do not run in the debugger.  Did you try that?

    -Jeff


    Jeff Sanders (MSFT)
    Wednesday, November 30, 2011 8:41 PM
    Moderator
  • Hello guys.

    I've ended up getting this error and it seems like it will only work when it's executed in response to a user initiated action (ex.: click). Is this a limitation of the current release or are the docs still out of sync??

    thanks.


    Luis Abreu
    Wednesday, January 04, 2012 2:12 PM
  • Hi Jeff,

     

    I have the same problem when I try to get to a link from setting pane. I tried to build a package and installed it. It doesn't work.

     

    Any ideas?

    Friday, January 13, 2012 1:04 AM
  • There is a check in the API to determine if you application window has focus.  When the settings pane is up, your application does not have focus so you get the error.

    Can you describe your scenarion and let me know why you want the user shelled out to a browser when they are making settings?

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, February 16, 2012 6:57 PM
    Moderator
  • It's been a some time since I was playing with this, so let me see if I recall it correctly...

    If I'm not mistaken, in my case, I wanted to open the browser with a search URL of an another web site which didn't expose that functionality through a web service. The idea was to do some processing to see if the app could get a reference to a doc the user was looking for. When that processing didn't return any results,then I'd simpy open the browser with that a custom built search URL and let that external app try to find what the user wants.


    Luis Abreu

    Friday, February 17, 2012 10:00 AM
  • Haven't found a way around this issue.  You can launch IE like this in WP7 and it's a very effective technique and excellent user experience.  I truely hope this capability opens up in the upcoming refresh.  I can't re-imagine some of our apps without being able to do this.


    MarkM

    Saturday, February 25, 2012 2:47 PM
  • It looks like the following seems to be working with Windows 8 RP and Visual Studio 2012 RC

    var uri = new Windows.Foundation.Uri(e.url);
    Windows.System.Launcher.launchUriAsync(uri);

    Saturday, June 02, 2012 10:08 PM
  • Thanks Dave for posting your results!

    Jeff Sanders (MSFT)

    Monday, June 04, 2012 11:53 AM
    Moderator