cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Maj <...@adobe.com>
Subject Determining if "you're in cordova"
Date Fri, 30 Nov 2012 23:27:45 GMT
I'm seeing this question pop up on our IRC, as well as in person after
meet ups, as well as on stack overflow here and there.

Scenario: I have a website, and I have a native app that uses cordova. My
cordova apps simply point to the website URL to get its contents.

The question becomes: since both browser and native versions of the app
include cordova.js, how do we know if we're in cordova or not?

I'm leaning towards a functional approach to determining that. Basically,
does the bridge work?

I know the easy answer from us is "don't do that" but I think for
platforms that don't have a stringent review process and want to oppress
apps from loading code dynamically (you know who you are) this is a
valuable approach. The build process can solve this problem but I still
think coming up with a good answer to this question has value.

What about during cordova.js' initialization we test the bridge (echo
plugin?). If it works, we set window.cordova.isWebView or some shit. If it
doesn't, well, it deosnt.

Thoughts/comments welcome!


Mime
View raw message