Web apps and stock android browser


Has anyone else noticed some trouble starting a Xojo web app on Android’s stock browser? (OK on chrome and firefox).
About 9 in 10 times, it’s stuck on the launching screen (showing just the first step in the progress bar). Happens on Galaxy S4, web app can be any of the examples included in Xojo (but mostly tested with CanvasBoxes project) running standalone.


Is that the old AOSP browser ?

yes that is the one. Aside from having a major security leak, a lot of users still prefer it over the chrome browser and even re-install it after it was removed. This problem should dissapear eventually once everyone goes to chrome, but I was wondering what could be the cause. The same problem may arise in other browsers like chrome in the future and knowing what happens is always an advantage. Is it some specific thing we should avoid doing in Xojo Web that causes the block? Or at least can we somehow give a message to the user that it does not work on this specific browser? That would keep them from calling our helpdesk :slight_smile:

I wouldn’t look for the standard browser to go away. There are still a lot of web sites that use Flash for content. Chrome on android won’t use plugins and thus has no Flash. Better security, yes. Compatibility with legacy web sites, no.

Not sure whats up.
But it probably is related to which version of Browser is in use.
Over the years its evolved not unlike IE, Chrome etc have and an older version may have issues where the latest from Android 4.4 might not.
Supporting every version of every browser just may not be practical as their capabilities very quite widely.

I do understand that supporting every browser is impossible. There was just a possibility that you already experienced it too and knew a solution/workaround.
As a fallback, is there no possibility to warn the user (after some timeout maybe) that it doesn’t work in his browser?

Thanks for looking into it anyway Norman!

The disconnect message appears if the browser was unable to download or initialize the framework for some reason. Unfortunately without the framework there’s nothing we can do.

I checked and in Session Open event, ShowURL works. So you can display an HTML page.
Since you have access to session.Header("User-Agent") it may be possible to spot the browser version that does not work with the app, and show it the HTML with the advice to use Chrome instead. If there is a difference between the native Android browsers User-Agent systems, and if the app had a chance to launch.

@Michel Bujardet I’m also looking into that :slight_smile:

This script should determin if it is the stock browser. Not 100% foolproof (as anyone can manipulate this) but a start.

var navU = navigator.userAgent;
// Android Mobile
var isAndroidMobile = navU.indexOf('Android') > -1 && navU.indexOf('Mozilla/5.0') > -1 && navU.indexOf('AppleWebKit') > -1;
// Android Browser (not Chrome)
var regExAppleWebKit = new RegExp(/AppleWebKit\\/([\\d.]+)/);
var resultAppleWebKitRegEx = regExAppleWebKit.exec(navU);
var appleWebKitVersion = (resultAppleWebKitRegEx === null ? null : parseFloat(regExAppleWebKit.exec(navU)[1]));
var isAndroidBrowser = isAndroidMobile && appleWebKitVersion !== null && appleWebKitVersion < 537;

Always better to be able to display something…

Unfortunately like Greg mentioned, we’ll never reach session Open as the framework cannot be loaded. And browsers on Samsung do give back false info:

Mozilla/5.0 (Linux; Android 4.4.2; nl-be; SAMSUNG GT-I9505 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36

Just a quick tought: Maybe I’ll let the user open another real .html file, do some checks there and if OK redirect it to the Xojo link…

Indeed that is the way : an HTML page with inside the script you posted ought to do that elegantly.

or even maybe simpler. I’ll put ‘Use Chrome. Launching…’ in the launch message :slight_smile:

The weird thing is it works very well in the stock browser the first time you load the app or open a new tab. When you do it in the same tab (or press reload), it fails. Must be a caching thing.

I like better the HTML page redirect : it allows a much friendlier message. Never underestimate the user mental limitations :wink:

Just found this phrase in another forum :
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” Rick Cook

So true! :slight_smile: