如何更改Cordova浏览器平台的默认浏览器? [英] How to change default browser of cordova browser platform?

查看:522
本文介绍了如何更改Cordova浏览器平台的默认浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有安装chrome,主要使用其他浏览器进行开发(opera,yandex等).但是命令:

I don't have chrome installed and I mainly use other browsers for development (opera, yandex etc). But the command:

cordova运行浏览器

cordova run browser

默认情况下使用chrome,因此失败并显示系统找不到文件chrome.".我可以更改科尔多瓦使用的浏览器吗?

uses chrome by default, so it fails with " The system can not find the file chrome.". Can I change which browser cordova uses?

推荐答案

更改默认Chrome浏览器的唯一方法是使用

The only way to change the default Chrome browser is using the --target option.

您会看到 Chrome是run命令的默认浏览器.

As you can see Chrome is the default browser for the run command.

内部, cordovaServe.launchBrowser函数与cli参数一起调用.

Internally, the cordovaServe.launchBrowser function is called with cli arguments.

此函数在cordova-serve/serve.js文件,您可以在

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.

这篇关于如何更改Cordova浏览器平台的默认浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆