I am struggling with opening the website inside the Cordova app using the Crosswalk engine. The default InAppBrowser is rendering the page inproperly, because it uses native WebView(which works bad on older phones like Android 4.3). I am trying to use the cordova-plugin-crosswalk-webview and while it seems to render the cordova view with Crosswalk(the navigator.userAgent says so), when I call either window.open or cordova.InAppBrowser(after installing cordova-plugin-inappbrowser) it uses the native WebView.
Is there something special I have to do to make it render that way ? I also tried this package github, but it seems to not be able to allow executing scripts in the inner browser and I need some sort of communication between the Cordova app and the browser page. Maybe there is some other way for making this communication work(the intention is to be able to show barcode scanner when clicking on the button).
Do you have any idea how to solve this issue ? Big thanks !
Try using this:
//config.xml
<allow-navigation href="http://cordova.apache.org/*" />
//code
window.open('http://cordova.apache.org/', '_self');
https://issues.apache.org/jira/browse/CB-9573
Open a website in crosswalk webview
Related
From web browser, I want the ability to open any app if installed (such as facebook, twitter etc) using java-script. I can't update intent file, want to do it solely from java-script. Is there a way from java-script to detect the installed apps (from IOS & Android) and open it?
You can use Firebase Dynamic Links https://firebase.google.com/docs/dynamic-links
It was designed to resolve the issues like yours.
So, I'm working on an app which is a web based app. The apps code base is mostly written in JavaScript and HTML. The app is also available on a native app which basically only contains a WebView displaying the HTML and JavaScript code.
My problem is that when a user is on the Android native version and launching an external link, it opens perfectly in the Android WebView but there is some cases where the launched page not is scrollable and other strange stuff.
So to solve this issue I need the native app to launch the in-build browser in the Android phone. Basically, the exact same effect that startActivity(new Intent(ACTION.VIEW,URI)) has.
The thing is that I can't modify the Android version though all the logic is written within the web app..
My question is:
Is there any way to simulate:
startActivity(new Intent(ACTION.VIEW,URI))
in JavaScript to get out of the native app and launch the browser instead?
Hello I am new to Weinre and I need to debug my website which seems to act strange when opened using an IOS platform.
So I am using Weinre to debug it. I installed the tool and tested it running with the demo targets in the server itself.
Now I need to add my website as a target and run it with an iphon (or ipad) and debug it with Weinre. I don't know how to add my website as a target, I cannot manually add the
<script src="http://123.456.7.89:8080/target/target-script-min.js#anonymous"></script>
script (do not have permission to manually change the page). so How can I do my debugging with Weinre?
Thanks
You can try using a bookmarklet. The main weinre server page actually has a bookmarklet in it, for itself, that you should be able to use directly, if you can figure out how to set up a bookmarklet for your device. This seems to change release-release for mobile browsers, so you might want to do a google search on "bookmarklet" and your device's name or the OS release, to see if anyone has any tips.
I build a webapp and I have social links in my webapp.
I am facing an issue regarding this. If I am having facebook installed in my device then on click of the share link it should open the native app instead of opening in browser.
And incase if I doesnt have any native app installed then it should automatically redirect to browser.
Here it is the code what I have tried:
Javascript:
if(isAndroid){
fb://profile//www.facebook.com/sharer/sharer.php // to open in native browser
http://wwww.facebook.com // to open in web browser.
}
How do I handle this urls...
Please help me out.
This is not possible, for privacy reasons.
See This answer
You can make Hybrid Application.
What you just need to do is ADD WEB INTERFACE which will make call to native source code through javascript and also get return value.
So you can write native function which will return if application is installed. Once you set this interface you can use it further for open that app and passing intent and all that.
You can do it easily. Start Here:
https://developer.android.com/guide/webapps/webview.html
I was trying the Geolocation example from the below link.
http://docs.phonegap.com/en/1.7.0/cordova_geolocation_geolocation.md.html#Geolocation
I copied the entire content from the first 'Full Example' and saved that file as an HTML. When I opened it in Chrome (desktop) and Android phone inbuilt browser(default), I got the following three alerts on both chrome and android phone.
gap:["Device","getDeviceInfo","XXXXXXXXXX"]
gap:["NetworkStatus","getConnectionInfo","XXXXXXXXXX"]
gap:["App","show","XXXXXXXXXX"]
I clicked 'Cancel' first time and even tried 'Ok' but, nothing happens. If I click 'OK' on all three alerts on my Android Phone, the page goes all white.
So I googled it and found couple of answers on Stack Overflow suggesting:
To remove the Cordova JS file for the desktop browser
Add android specific JS from the Cordova.
So I tried both but none of them worked. Latest, I tried the following solution.
I downloaded the Cordova package (3.0.0), there was a cordova-android.zip which had the cordova.js file at the following path.
/cordova-android/framework/assets/www/cordova.js
So, now my script element looks like this:
<script type="text/javascript" charset="utf-8" src="/cordova-android/framework/assets/www/cordova.js">
After modified the <script> element as above, I don't get alerts in Chrome, but I still get following NEW alerts on my Android phone.
gap:["PluginManager","startup","Plugin ManagerXXXXXXXXXX"]
gap:["App","show","XXXXXXXXXX"]
Code: 1, message: User denied Geolocation.
So, now I have following questions:
How do I solve this problem (to run the HTML page without alert on all devices/browser)?
Any idea on why did my alerts change after changing the cordova.js file?
Regards,
Rumit
Your problem is that you're using cordova.js as if it's a JS library like jQuery, but Phonegap (Cordova) is a hybrid framework not a mobile browser framework (see here for clarification). It's not intended to be used as a standalone JS library in a webpage, but in conjunction with a native Phonegap library in order to build a native application. If you created your page as a Phonegap app and built it for Android, you would be able to (and need to) allow the app permission to use geolocation.
Phonegap apps are implemented via a native WebView and in the case of the Geolocation API, Phonegap will use only use its own implementation if the device doesn't already have a native W3C implementation (which Android does).
So the point is: either create a proper Phonegap app for Android by following the platform guide or simply don't use the Phonegap JS at all since you can call the Android browser's geolocation API (navigator.geolocation) directly from Javascript in your webpage - you don't need Phonegap's JS file to allow you to do this (have a look at the answer to this question).