cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anis KADRI <>
Subject Re: Determining if "you're in cordova"
Date Tue, 04 Dec 2012 01:03:09 GMT
document.addEventListener('deviceready', function() {navigator.inCordova =
true;}, false);

If you fire 'deviceready' yourself then you already know that you're not in
a cordova app context. Don't you ?

Sorry, I really don't see what the problem is. Maybe an real world example
would help illustrate it. Or is there a reason why you don't want to use
deviceready as an indicator ?

On Mon, Dec 3, 2012 at 4:40 PM, Max Ogden <> wrote:

> if cordova polyfilled standard apis for everything it wouldn't be cordovas
> problem. but right now there are only-in-cordova APIs that I need to use if
> i'm in cordova. it would be more convenient for me as an app developer if
> there was a supported way to know i'm in cordova.
> I can keep looking at window.location.href and make sure to always run a
> local web server for development (and never open the file directly on my
> dev machine) but the point here is that doing those things is more pitfall
> prone and less user friendly for new devs than doing "if
> (navigator.inCordova)".
> if its a ton of work to implement then I can understand not doing it (I
> dont know what it would take to implement). i'm just trying to say it would
> be a nicer api :) it seems from my perspective that it would be easy for
> cordova to tell the browser that cordova is present and it would save app
> developers from having to use yet another hacky technique.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message