Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在kiosk模式下启动Chrome Linux/MacOS ASP.NET内核_C#_.net_Asp.net Core - Fatal编程技术网

C# 如何在kiosk模式下启动Chrome Linux/MacOS ASP.NET内核

C# 如何在kiosk模式下启动Chrome Linux/MacOS ASP.NET内核,c#,.net,asp.net-core,C#,.net,Asp.net Core,我有这段代码 public static void OpenBrowser(string url) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { WindowsBrowser.Launch(url); //My own code behind, works fine } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { Proces

我有这段代码

public static void OpenBrowser(string url) {
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
    WindowsBrowser.Launch(url); //My own code behind, works fine
} else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {
    Process.Start("xdg-open", url);
} else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
    Process.Start("open", url);
} else {
    // throw 
}

Windows部件工作正常,根据需要在kiosk模式下启动Chrome。对于Linux和MacOS,如何才能做到这一点?

您必须指向二进制文件,才能将适当的命令行参数传递给进程

例如,在Mac上,您可以执行以下操作:

Process.Start("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "--kiosk https://google.com");

我认为在Linux上也会有类似的情况。不幸的是,只有在没有其他窗口打开并且用户没有重命名应用程序文件的情况下,此操作才有效。

我知道必须没有打开的窗口。可以做些什么来避免这个问题?