From 898ed4a6a574bccee0adc596ac5e87694963be4c Mon Sep 17 00:00:00 2001 From: Chen-I Lim Date: Mon, 24 May 2021 16:06:47 -0700 Subject: [PATCH] Fix MM-35819 for Windows --- win-wpf/Focalboard/MainWindow.xaml.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/win-wpf/Focalboard/MainWindow.xaml.cs b/win-wpf/Focalboard/MainWindow.xaml.cs index cd3e4f158..0c50dab86 100644 --- a/win-wpf/Focalboard/MainWindow.xaml.cs +++ b/win-wpf/Focalboard/MainWindow.xaml.cs @@ -134,7 +134,7 @@ namespace Focalboard { webView.ContentLoading += WebView_ContentLoading; - var url = String.Format("http://localhost:{0}", port); + var url = String.Format("http://localhost:{0}/", port); webView.Source = new Uri(url); } @@ -146,7 +146,10 @@ namespace Focalboard { private void WebView_ContentLoading(object sender, CoreWebView2ContentLoadingEventArgs e) { // Set focalboardSessionId - string script = $"localStorage.setItem('focalboardSessionId', '{sessionToken}');"; + var url = String.Format("http://localhost:{0}/", port); + string script = $@"if (window.location.href.toLowerCase().startsWith('{url}'.toLowerCase())) {{ + localStorage.setItem('focalboardSessionId', '{sessionToken}'); + }}"; webView.ExecuteScriptAsync(script); } }