facebook

Call Safari Browser from within Native App

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #344641 Reply

    herb200mph
    Participant

    How do we use a button to open a Safari Browser Window from within a Native App.

    We want to display a .PDF file in the browser window when it opens.

    We are also assuming that if there are several buttons, the code will open the browser as a new window and display the file.

    We are currently using a web app to view PDFs in the browser window.

    Now we want to do a Native App and call the window to show the PDF.

    Does anyone have the javascript code to add to the link button to do this?

    Thanks in advance.

    P.S. We do not need to open the browser within the app, but just open the browser on the device external to the app.

    #344667

    support-michael
    Keymaster

    Consider using a GotoURL action. It provides options for opening an internal popup browser window for a target url or the device’s default browser window. This config below will open an independent safari browser on the URL. Choosing the popup options will open an internal modal browser similar to what programs such as twitterific or pulse do to show web content without leaving the app.

    #344687

    herb200mph
    Participant

    Here is what worked:

    The buttons on the screen were set to “Go to URL” and open it as a “Popup (Toolbar)” which called an “.htm” page that has the “.pdf” called as an image. A little CSS and DIV coding and it displayed just the way the client wanted.

    More important – PINCH AND ZOOM, SCROLLING work perfectly.

    Nowthen – we would like to put some extra navigation elements into the “.htm” pages to get to other destinations in the app when the popup window is open and showing a “.pdf.”

    What coding to we need to do to make the links hit certain screen targets within the app?

    Thanks again for the guidance that helped us solved one problem and if you have a few minutes, please tell us how to code the <a> part of the links to open specific app screens app screens.

    #344698

    support-michael
    Keymaster

    >What coding to we need to do to make the links hit certain screen targets within the app?

    Thinking….
    The popup window (i.e., a Cordova InAppBrowser component) is a separate dom independent of the app’s UI/dom. I haven’t done this yet but the inappbrowser api provides ability to inject js which could be to set js callback on controls in the inappbrowser’s dom. Thus it should be possible to have the code callback to control itself and modify the main app ui. For example, user clicks button in InAppBrowser UI that results in doing some final actions in the browser, close the browser and then transition the app to a new screen.
    Here’s the api, http://docs.phonegap.com/en/2.9.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser
    I think it is available to you from the phoneui.showURL() function (need to check this asap – I’m on the road atm without access to workstation).

    #344700

    herb200mph
    Participant

    Thanks Wayne.

    When you get a chance to wrangle the js code for this, it would be appreciated.

    It would be handy to open one/several additional windows at the same time and I would assume that adding an “onClick” to the individual buttons might be a solution.

    Will try any code you send.

    P.S. Out of town myself until Sunday evening.

    Again – thanks.

    #344744

    support-michael
    Keymaster

    I reread previous posts.

    >Nowthen – we would like to put some extra navigation elements into the “.htm” pages to get to other destinations in the app when the popup window is open and showing a “.pdf.”

    After rereading your previous post on this thread my current understanding is your are seeking to have a non-modal independent browser window. Can you confirm?

    The native app GotoURL/popup action (InAppBrowser) opens a modal browser window. This will mechanism will not support non-modal independent browser window. Additionally opening a system browser window (non-modal, independent browser) will not provide a mechanism for calling back into your app.

    If I’m misunderstanding your goals perhaps sharing a small low fidelity storyboard mockup will help us grok your goals.

    #344748

    herb200mph
    Participant

    Wayne:

    Thanks.

    Right now, we have a button, that goes to a URL (htm page with pdf as img call).

    When clicked, button opens a new modal window.

    When “Done,” the window closes and returns to the button page.

    Is there:

    1) a way to open a new modal window when button is clicked, or
    2) a way to open the htm page in a Safari browser window external to the app?

    It would be perfect is several windows could be open within the app at the same time, re: a menu page, then several document pages, etc.

    We see that a possible “caching” issue could come up as we want those PDF documents to be embedded for offline use.

    If not do-able, then so be it.

    And – along the same note, thanks for your help with this and follow up.

    HERB

    #344803

    herb200mph
    Participant

    Anyone have a solution idea yet to opening a separate Safari browser window from within a native app.

    #344807

    support-michael
    Keymaster

    >1) a way to open a new modal window when button is clicked, or
    >2) a way to open the htm page in a Safari browser window external to the app?

    >It would be perfect is several windows could be open within the app at the same time, re: a menu page, >then several document pages, etc.
    >Anyone have a solution idea yet to opening a separate Safari browser window from within a native app

    Yes, attach a GotoURL action with the “new window” property. See attachment gotourl-system-browser.png

    Attachments:
    You must be logged in to view attached files.
Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Call Safari Browser from within Native App

You must be logged in to post in the forum log in