locked
Opening link from mobile app in external browser RRS feed

  • Question

  • User-350763668 posted

    I am a web developer working in ASP. NET for the first time in a new position. I was tasked with creating a link which would lead from a razor web page which is displayed within a in-mobile-app browser to an external link, which we would like opened on the user's system browser. This is something that it sounds as though no one on my team has experience with, since the mobile app dev is new to our project. I have tried a couple of options, but am not having any luck. Here are the attempts I have made, and the results:

    <a href = "@externalURL" target= "_blank" >
        <button type="button" class="btn btn-primary">
            Button Name
        </button>
    </a>

    This has a result of the button leading to the link within the mobile app browser. I want the link to lead me to a new window within the phone's default browser (i.e. Safari)

    <a href = "#" onclick= "window.open('@externalURL', '_system');" >
        <button type="button" class="btn btn-primary" disabled="@(!_acknowledged)">
            Button Name
        </button>
    </a>

    When tested on desktop, this does the trick (although it does leave the original page with a default page), but when tested within mobile, it once again does not open a new browser, or even the window within the in-app browser.

    Does anyone know what I may be doing wrong here? This seems like it should be trivial, but I have not been able to find the resources from searching Google or StackOverflow

    Sunday, May 9, 2021 1:23 PM

All replies