I want you to open a link in my app via browser not in Appview. I ma making my html5 mobile app via xdk. I don't want to use cordova in my app as my app is heavy enogh and don't want to make it heavier because of just one link.
I saw this :
www.kidzout.com
But the problem is I must install Cordova InAppBrowser plugin for this to work. Do you have any solution without using Cordova or external plugins? Do you think is it possible at all?
You can open a link in the native browser(Mobile Safari, Android, etc.) from within a HTML5 Mobile app using the intel.xdk API formerly AppMobi.
In the head, include a reference to the intelxdk.js file.
<script src="intelxdk.js"></script>
Use this for opening your link:
Launch in Browser
For more information, go to http://www.html5dev-software.intel.com/documentation/jsAPI/device/launchExternal/index.html
If you are opening a remote URL in your webview and adding javascript is not an option, you can make a patch in native code.
Here I show the workaround for Android:
https://stackoverflow.com/a/35037737/813951
Related
I've been working on an HTML5 app in the Intel XDK lately and part of the app is buttons that link to external websites. I'm having a problem with the apps opening in the same window, which then causes the user to get stuck in the browser. I'm using the Jquery mobile framework currently. I constantly call the link to open in a "_blank" target, and have also tried several other things such as "window.load". What do I do to get this to work? The app has to work with android and iOS. Any help is appreciated.
Use the Cordova inAppBrowser plugin, see the docs here: https://github.com/apache/cordova-plugin-inappbrowser You will want to use _system target with it.
Intending to view a PDF File from the Hybrid Mobile App , created using HTML5 Jquery and Packaged with Phonegap.
But unable to achieve it ,
Things i tried
<object src="xyz.pdf" type="application/pdf"></object>
also,
window.open('xyz.pdf'); //through javascript
and
$(document).load('xyz.pdf');
Can anyone suggest the best way for viewing the PDF in a Hybrid Android Mobile App.
with cordova you must think about these:
HTML 5 object tag: not working
If you try with:
window.open('http://www.???.com/my.pdf', '_blank', 'location=yes');
The InAppViewer canĀ“t open this kind of files.
I think that there aren't an hybrid solution for this problem.
You must start to search or write about a plugin that use a native pdf's opening and then use it.
An example:
cordova-plugin-file-opener
The latest solution, a little more simple but include to open google docs is:
window.open('https://docs.google.com/viewer? url=http://www.example.com/test.pdf&embedded=true', '_blank', 'location=yes');
ref = window.open('index.html', '_self');
Go look at the Mozilla pdfJS project.
This project allows you to open a pdf (embedded in app or remote) in your app. No break-out links that relies on native viewers.
They also give you a very full featured sample viewer, that you can use as is, but much of functionality in that does not apply to mobile applications.
I have had success with this on Android 4.3 Devices.
Try installing the InAppBrowser plugin to do so. I have use it to open PDF files right inside the app on both iOS and Android.
Check the official InAppBrowser doc with full doc and examples, it has several options you can enable/disable (be sure to point to your current cordova version documentation):
My solution for connected apps with offline availability...
window.open('http://www.someserver.com/doc.pdf', '_system')
...this will open in default pdf viewer. I have my clients use adobe reader for obvious reasons. And also because once it is downloaded the first time, adobe app manages and edits the documents well, and the documents are also available offline from within adobe reader thereafter. Even pdf forms.
Have cordova.js linked on the page.
Have inAppBrowser added.
For full offline you may try FileOpener plugin. I have not needed to do that on android, but I have used that way in iOS.
Hope any of this may help.
Though am late here, still want to share what I know. You can use this plugin to view PDFs in the app (without inappbrowser). Supports only Android and iOS.
Hi I'm working around with jquery mobile and cordova 3 on a android device.
Everything works great except that I can't open links in the default browser or for example the maps application.
I can open it with a inappbrowser plugin but I dont want to do that. I just want to open the links to websites with the default browser.
I tried many things like here:
Opening Link in System Browser in PhoneGap 3.3 on Android
Open Links in Default Browser using Phonegap/Cordova
But I saw that the answers are showing the solution with the inappbrowser which I dont want.
How can I solve this?
Thanks for any help
For Android OS use following code.
navigator.app.loadUrl("http://google.com", {openExternal : true});
or through inline JavaScript:
<a onclick="navigator.app.loadUrl('https://google.com/', { openExternal:true });">Link</a>
It will NOT work with iOS, also, I don't know, if currently exist a solution for iOS, that don't require inappbrowser.
I am making a Hybrid Application using cordova-cli. My requirement is that the first page in my application must redirect to a website. The entire data required for the application will be loaded into this website from some other data-sources.
The requirement is to access device native features such as camera, accelerometer etc. from pages on this website.
I am using
location.href="http://www.example.com";
to open the pages. I need a unified cordova.js file with all the plugins embedded into it.
Currently I am putting the individual plugins into the lib\android\plugin\android and by using the grunt -f command from grunt-cli, the cordova.js file recieved for android does not seem to produce expected results.
Can't be done I am afraid - because of the way Cordova interacts with the device.
What happens if, using a non-mobile device, you accessed the same website from elsewhere? The website will not know what on earth Cordova is.
Cordova interacts with the native code on the device, so requires this to handle the passing of JS-to-native, and vice-versa.
At startup, my Phonegap application loads a hosted application (cordova is loaded from there). In certain cases (events) I want to redirect the user to an html file that lives in the phone.
Is there a way to accomplish that?
I've tried redirecting to file:///android_asset/www/index.html but doesn't seems to work.
Maybe a PhoneGap plugin that exposes Android's loadUrl() to JavaScript?
EDIT: I'm using Phonegap 2.8
You can use navigator.app.loadUrl:
navigator.app.loadUrl("file:///android_asset/www/index.html");