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上也会有类似的情况。不幸的是,只有在没有其他窗口打开并且用户没有重命名应用程序文件的情况下,此操作才有效。我知道必须没有打开的窗口。可以做些什么来避免这个问题?