I don't have chrome installed and I mainly use other browsers for development (opera, yandex etc). But the command:
cordova run browser
uses chrome by default, so it fails with " The system can not find the file chrome.". Can I change which browser cordova uses?
1. I figured out that Cordova is not using the Chrome App as browser. Instead it is using the browser integrated in the "Android System WebView" app, which is updatable in Google Play Store. Actually it is Chrome, but a different version from the Chrome App.
Before you begin working with the Browser platform, there are a few things you should know. First, you have to actually add the platform. That means running cordova platform add browser . And if you want the latest, then you need to specify cordova platform add [email protected] .
Apache Cordova applications leverage HTML, CSS and JavaScript to create mobile applications that run across multiple device platforms including Android, iOS, and Windows.
Test the following command:
cordova run browser --target=firefox
The only way to change the default Chrome browser is using the --target
option.
As you can see Chrome is the default browser for the run
command.
Internally, the cordovaServe.launchBrowser function is called with cli arguments.
This function is defined in the cordova-serve/serve.js file and you can find its body in the cordova-serve/src/browser.js file where you can find the complete list of supported browsers for each platform:
var browsers = {
'win32': {
'ie': 'iexplore',
'chrome': 'chrome --user-data-dir=%TEMP%\\' + dataDir,
'safari': 'safari',
'opera': 'opera',
'firefox': 'firefox',
'edge': 'microsoft-edge'
},
'darwin': {
'chrome': '"Google Chrome" --args' + chromeArgs,
'safari': 'safari',
'firefox': 'firefox',
'opera': 'opera'
},
'linux' : {
'chrome': 'google-chrome' + chromeArgs ,
'chromium': 'chromium-browser' + chromeArgs,
'firefox': 'firefox',
'opera': 'opera'
}
};
I hope that this answer will help you to learn a bit more about cordova and the way it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With