@@ -14,6 +14,7 @@ public class Webview : IDisposable
1414 {
1515 private bool _disposed = false ;
1616 private bool ? _loopbackEnabled = null ;
17+ private bool _skipLoopbackCheck = false ;
1718 private List < CallBackFunction > callbacks = new List < CallBackFunction > ( ) ;
1819 private List < DispatchFunction > dispatchFunctions = new List < DispatchFunction > ( ) ;
1920
@@ -29,13 +30,17 @@ public class Webview : IDisposable
2930 /// <param name="interceptExternalLinks">
3031 /// Set to true, top open external links in system browser.
3132 /// </param>
32- public Webview ( bool debug = false , bool interceptExternalLinks = false )
33+ /// <param name="skipLoopbackCheck">
34+ /// Set to true to skip checking for the loopback exception.
35+ /// </param>
36+ public Webview ( bool debug = false , bool interceptExternalLinks = false , bool skipLoopbackCheck = false )
3337 {
3438 _nativeWebview = Bindings . webview_create ( debug ? 1 : 0 , IntPtr . Zero ) ;
3539 if ( interceptExternalLinks )
3640 {
3741 InterceptExternalLinks ( ) ;
3842 }
43+ _skipLoopbackCheck = skipLoopbackCheck ;
3944 }
4045
4146 /// <summary>
@@ -279,8 +284,10 @@ private string ExtractUrlArgument(string jsonArray)
279284
280285 private bool ? CheckLoopbackException ( string url )
281286 {
287+ if ( _skipLoopbackCheck )
288+ return true ;
282289 // https://docs.microsoft.com/de-de/windows/win32/sysinfo/operating-system-version
283- if ( Environment . OSVersion . Version . Major < 6 || ( Environment . OSVersion . Version . Major == 6 && Environment . OSVersion . Version . Minor < 2 ) )
290+ else if ( Environment . OSVersion . Version . Major < 6 || ( Environment . OSVersion . Version . Major == 6 && Environment . OSVersion . Version . Minor < 2 ) )
284291 return true ;
285292 else if ( ! url . Contains ( "localhost" ) && ! url . Contains ( "127.0.0.1" ) )
286293 return null ;
0 commit comments