I want to make sure to launch inappbrowser only if I am on devices (iOs, Android...), but if I am in browser (local development mode or just a Web App with gulp build), I wa
We have a simple way to know if we are running the '/www' folder of the project in browser, or in a device (emulate/build).
In local projects of Cordova/Phonegap, the index.html has this label:
But this file does not exists, because Cordova/Phonegap will inject phonegap.js or cordova.js when we emulate or build. And if we run www folder in browser, always can see an error like this:
GET file:///D:/Cordova/Workspace/TestProject/www/cordova.js net::ERR_FILE_NOT_FOUND
Then we can check in the index.html label if this file loads or not. If loads, we are in App, if not, we are in browser (local):
We think is the fastest way to know where are we.