1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
    mkessler is on a distinguished road

      0  

    Default Unanswered: Open link in Safari from iOS packaged App

    Unanswered: Open link in Safari from iOS packaged App


    Hi,
    I have a link on my mobile app with a target="_blank" attribute. The app is packaged as a native iOS app. The problem is, the link is not opening in Safari as expected, instead it opens inside the app. It is very important that the link opens in Safari in a new browser window. How can I achieve that?

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    Answers
    102
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    I think you're going to have to make a native call to open safari.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
    mkessler is on a distinguished road

      0  

    Default


    How to do that? Can you point me to the documentation?

  4. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    14
    Vote Rating
    0
    Answers
    1
    graemlourens is an unknown quantity at this point

      0  

    Default


    I would love to know that too.

    A part of our app is opening a PDF, and when opened (in webview obviously) there is no possible way of getting back than deleting app from memory.

    Has anybody found a hack?
    @sencha are you looking into this in any way already?

    Regards, Graem

  5. #5
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
    mkessler is on a distinguished road

      0  

    Default Use Phonegap

    Use Phonegap


    I ended up using Phonegap (now Cordova) for packaging. You can modify the view controller to allow opening of links outside of the app.

  6. #6
    Sencha Premium Member dawesi's Avatar
    Join Date
    Mar 2007
    Location
    Melbourne, Australia (aka GMT+10)
    Posts
    1,083
    Vote Rating
    44
    Answers
    24
    dawesi has a spectacular aura about dawesi has a spectacular aura about

      0  

    Default


    just for those who might get confused, phoneGap is still phoneGap, Cordova is to phoneGap as webkit is to Chrome or Safari
    Teahouse Training Company
    Official Certified Sencha Trainer

    Australia / New Zealand / Singapore / Hong Kong & APAC



    SenchaWorld.com - Sencha webinars, videos, etc
    SenchaForge.org - (coming soon)
    TeahouseHQ.com - Sencha ecosystem training portal

    Code Validation : JSLint | JSONLint | JSONPLint

  7. #7
    Touch Premium Member svenna's Avatar
    Join Date
    Jun 2007
    Location
    Oslo,Norway
    Posts
    568
    Vote Rating
    27
    Answers
    6
    svenna has a spectacular aura about svenna has a spectacular aura about

      1  

    Default


    Opening a PDF from a native package app is really important.

    There is many people asking about open links (external pages or pdf files) so Sencha, please recognize it's importance and look for a solution for 2.0.x

    I still have 3-5 weeks before production, but for now it looks like I should abandon the sencha packaging av look for PhoneGap/Cordova.

    I've looked at a few solutions, some people try the iframe support. Many get problems scrolling but it looks like making a really, really, large iframe that includes the PDF can be a "solution"

    Also, there is a ux for using target: _blank on a click event, but I can't see that this would be better than target="_blank" in the a tag. (read: not working)

    Refs:
    http://www.sencha.com/forum/archive/.../t-174759.html
    http://www.sencha.com/forum/archive/.../t-129038.html
    Sven Tore Iversen

  8. #8
    Sencha Premium Member
    Join Date
    Apr 2009
    Posts
    208
    Vote Rating
    8
    Answers
    5
    jhoweaa is on a distinguished road

      0  

    Default


    This is definitely something I'm very interested in. Displaying PDF's is critical to our application and if we can't do it from Touch we'll have to use a different solution.

  9. #9
    Sencha User =NR='s Avatar
    Join Date
    Mar 2013
    Location
    Singapore
    Posts
    112
    Vote Rating
    0
    Answers
    2
    =NR= has a little shameless behaviour in the past

      0  

    Default


    dunno what exactly you mean by iso packaged app (I'm currently confused with sencha native packager and phonegap, cordova packager).

    If you use phonegap/cordova,just open
    Xcode -> click the folder icon -> resources -> config.xml

    inside the plugins tag add the following line:
    Code:
    <plugin name="InAppBrowser" value="CDVInAppBrowser" />
    save it and in your app you can just:

    window.open("http://www.yoururlgoeshere.com", "_system"); //second parameter tell phonegap to open the url on device browser

    3 values for the second parameter and its explanation:
    • _self - opens in the Cordova WebView if url is in the white-list, else it opens in the InAppBrowser
    • _blank - always open in the InAppBrowser
    • _system - always open in the system web browser
    full explanation: http://docs.phonegap.com/en/2.3.0/co...r.md.html(just search for "_system" or "window.open()"
    Last edited by =NR=; 23 Dec 2013 at 12:25 AM. Reason: formatting the text