[英]perl - Launch url in browser opening in non-default browser
I try to launch my default browser and open to a specified URL as suggested here using something like: 我尝试启动默认浏览器,并使用如下所示的方法打开此处指定的URL:
use Browser::Open qw( open_browser );
my $url = 'http://www.google.com/';
open_browser($url);
But it opens it in Firefox even though Chromium is set to my default browser: 但是即使Chromium设置为我的默认浏览器,它也会在Firefox中打开它:
How do I get it to open in Chromium? 如何在Chromium中打开它?
Perl has no concept of default browser. Perl没有默认浏览器的概念。 As you can see in its documentation ,
Browser::Open
will go down the list of known browser invocation commands and use the first one that works. 正如您在其文档中所看到的,
Browser::Open
将在已知的浏览器调用命令列表中向下移动,并使用第一个有效的命令。 Firefox apparently happens to be higher on the list than Chromium. Firefox显然比Chromium排名更高。
If you want to invoke Chromium, then just invoke Chromium yourself. 如果您要调用Chromium,则只需自己调用Chromium。 Something like this should do:
这样的事情应该做:
system("chromium \"$url\"")
(you might have to change the name of the executable, depending on your system and PATH
) (您可能必须更改可执行文件的名称,具体取决于您的系统和
PATH
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.