(RDMLX/JavaScript) Open URL in Browser
(RDMLX/JavaScript) Open URL in Browser
I am using the JavaScript FileTranfer API to download a file (PDF) to the device. I would like to open the file in the native browser (in order to have the native sharing/open in menu). I am trying to use the LONGRANGE.Form openurl operation, but I am unsure how to format the URL for the browser. I am storing the files locally in '/mobile/files/'...though I know this is relative to the app. Is there a way to determine the URL relative to the device, or another way to open the link in Safari? or a way to instead open the LONGREACH app via URL? I am webviews with no titlebar or application menu, so I would have a hard time using a DocumentView...
-
tsupartono
- Posts: 289
- Joined: Wed Apr 18, 2012 10:21 am
Re: (RDMLX/JavaScript) Open URL in Browser
Unfortunately there is currently no way to open a local file using Safari from LongRange. We can (1) enhance LongRange to do so, but we can also (2) enhance the LongRange WebView to have the iOS native sharing options.
Would (2) work for you?
Would (2) work for you?
Re: (RDMLX/JavaScript) Open URL in Browser
I think the second option would work best...so long as it can be controlled by the JavaScript API. What would work best for me would be something like the functionality in the LongReach app (in the attached screenshot).
My use case is downloading Sales/Marketing material for a mobile salesforce...for use offline. Currently the app is 100% HTML5/JavaScript, using the JavaScript API and starting in a single webview.
My use case is downloading Sales/Marketing material for a mobile salesforce...for use offline. Currently the app is 100% HTML5/JavaScript, using the JavaScript API and starting in a single webview.
- Attachments
-
- screenshot.png (429.38 KiB) Viewed 6647 times
Re: (RDMLX/JavaScript) Open URL in Browser
I was just looking at my post and realized that if there were just operations for "Open", "Open In...", and "Email" (where the local file would be attached) that would work. I would worry about the UI in that case. Maybe it could be added as a method (or methods) to the LONGRANGE.LocalFiles API??? Not sure how that would work across platforms...
-
tsupartono
- Posts: 289
- Joined: Wed Apr 18, 2012 10:21 am
Re: (RDMLX/JavaScript) Open URL in Browser
The 'Open' functionality could be achieved by opening the PDF in the LongRange Web View (using iframe, frame, or window.open).
The 'Email' functionality is part of the native iOS Share UI.
So, what about if we add these two additional operations:
The 'Email' functionality is part of the native iOS Share UI.
So, what about if we add these two additional operations:
- Open in
- Share
Re: (RDMLX/JavaScript) Open URL in Browser
Yes, I think that should work.
-
tsupartono
- Posts: 289
- Joined: Wed Apr 18, 2012 10:21 am
Re: (RDMLX/JavaScript) Open URL in Browser
When do you need this implemented by?
The "Open in/Share" operations could be relevant for other platforms as well, however we'll begin implementation for iOS only and later for other platforms as time permits.
The "Open in/Share" operations could be relevant for other platforms as well, however we'll begin implementation for iOS only and later for other platforms as time permits.
Re: (RDMLX/JavaScript) Open URL in Browser
I can probably preview the file(s) in an iframe (or object) and add the support for 'open in' and 'share' once available. Our target delivery to 100+ users is September, 2016, so giving some lead-time for implementation and test - probably no later than June, 2016 to be in the first release. Of course, sooner is always better; but I think this is a 'nice to have', not a 'must have'.
Our app is intended to be BYOD, so having similar functionality across platforms is important...but we can code around platform differences if necessary.
Thanks for all of your help, Tony. We really appreciate the support from you and your team!
Regards,
Edward
Our app is intended to be BYOD, so having similar functionality across platforms is important...but we can code around platform differences if necessary.
Thanks for all of your help, Tony. We really appreciate the support from you and your team!
Regards,
Edward
Re: (RDMLX/JavaScript) Open URL in Browser
Tony,
I'm still having trouble coding the simple 'Open' command. I think the issue to do with my app design and the way the webview works. My app does not have a LongRange TitleBar or Menu, everything is created in HTML5 and uses the JavaScript APIs (kind of like using LongRange in a manner similar to PhoneGap).
I have tried using window.open(), using the _blank parameter, using the <object> tag inside a <div>, and using an <iframe> to open/view a PDF document. Each of these resulted in the PDF being displayed in the full webview window...meaning the app navigation was no longer visible. I can't use the openurl action because of the relative path.
Please let me know if you have any ideas.
Thanks,
Edward
I'm still having trouble coding the simple 'Open' command. I think the issue to do with my app design and the way the webview works. My app does not have a LongRange TitleBar or Menu, everything is created in HTML5 and uses the JavaScript APIs (kind of like using LongRange in a manner similar to PhoneGap).
I have tried using window.open(), using the _blank parameter, using the <object> tag inside a <div>, and using an <iframe> to open/view a PDF document. Each of these resulted in the PDF being displayed in the full webview window...meaning the app navigation was no longer visible. I can't use the openurl action because of the relative path.
Please let me know if you have any ideas.
Thanks,
Edward
-
tsupartono
- Posts: 289
- Joined: Wed Apr 18, 2012 10:21 am
Re: (RDMLX/JavaScript) Open URL in Browser
Hi Edward,
Yes you are right in that the iframe method wouldn't work as LR would open the PDF in the web view itself instead of in the iframe. This is due to the way we handle navigation and currently there is no plan to make iframes work in LongRange, I apologise for the misinformation.
However, the "window.open" method should work. I have done a simple test of downloading a PDF using the FileTransfer (LongReach) APIs, and opening that using window.open - that seemed to work for me.
Please see the attached screenshot (the PDF opens in a window).
Here is the code that I use to open the PDF:
Let me know how you go.
Yes you are right in that the iframe method wouldn't work as LR would open the PDF in the web view itself instead of in the iframe. This is due to the way we handle navigation and currently there is no plan to make iframes work in LongRange, I apologise for the misinformation.
However, the "window.open" method should work. I have done a simple test of downloading a PDF using the FileTransfer (LongReach) APIs, and opening that using window.open - that seemed to work for me.
Please see the attached screenshot (the PDF opens in a window).
Here is the code that I use to open the PDF:
Code: Select all
window.open("DownloadedContents/TestPDF.pdf");
- Attachments
-
- PDF.png (114.16 KiB) Viewed 6623 times