locked
Open links with hashmark/fragment (#)

    Question

  • I noticed that links containing a hashmark is opened with the hash and everything after it stripped.

    Example:

    <a href="http://microsoft.com/#test1" target="_blank">Open me</a>

    This will load "http://microsoft.com" in the default browser, and not "http://microsoft.com/#test1".

    How can I make Windows open the full URL in this case? Preferably without modifying the markup which I have no good control over in my case.

    Tuesday, April 23, 2013 11:46 PM

Answers

  • Hi,

    You can jump to uri in javascript .. For example :

    HTML

    <a id="clickme" href="#">Open me</a>

    In the page javascript (in ready event) hook up the click event:

     ui.Pages.define("/samplepage.html", {
           
            ready: function (element, options) {
                document.body.querySelector("#clickme").addEventListener("click", function (x) {
                    var uri = new Windows.Foundation.Uri("http://microsoft.com/#test1")
                    Windows.System.Launcher.launchUriAsync(uri);
                }, false);
    }
    }();

     - Girija

    Thursday, April 25, 2013 2:58 AM