For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 8 replies, 2 voices, and was last updated 12 years, 4 months ago by
support-michael.
-
AuthorPosts
-
herb200mphParticipantHow 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.
November 21, 2013 at 5:29 am #344667
support-michaelKeymasterConsider 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.
November 21, 2013 at 2:09 pm #344687
herb200mphParticipantHere 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.
November 22, 2013 at 6:38 am #344698
support-michaelKeymaster>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).November 22, 2013 at 7:06 am #344700
herb200mphParticipantThanks 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.
November 25, 2013 at 6:31 am #344744
support-michaelKeymasterI 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.
November 25, 2013 at 7:09 am #344748
herb200mphParticipantWayne:
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
November 26, 2013 at 8:46 am #344803
herb200mphParticipantAnyone have a solution idea yet to opening a separate Safari browser window from within a native app.
November 26, 2013 at 10:40 am #344807
support-michaelKeymaster>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 appYes, 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. -
AuthorPosts
