Results 1 to 9 of 9

Thread: Open link in Safari from iOS packaged App

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
      0  

    Default 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 User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Answers
    102
    Vote Rating
    87
      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
      0  

    Default

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

  4. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    14
    Answers
    1
    Vote Rating
    0
      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
      0  

    Default 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,093
    Answers
    25
    Vote Rating
    56
      0  

    Default

    just for those who might get confused, phoneGap is still phoneGap, Cordova is to phoneGap as webkit is to Chrome or Safari
    Lead Trainer / Sencha Specialist
    Community And Learning Systems

    Lead Architect
    DigitalTickets.net

  7. #7
    Sencha Premium Member svenna's Avatar
    Join Date
    Jun 2007
    Location
    Oslo,Norway
    Posts
    642
    Answers
    7
    Vote Rating
    40
      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
    285
    Answers
    9
    Vote Rating
    21
      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
    115
    Answers
    2
    Vote Rating
    -1
      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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •