diff --git a/CefSharp.Wpf/ChromiumWebBrowser.cs b/CefSharp.Wpf/ChromiumWebBrowser.cs
index 7e429a9de..5a4f4f9a4 100644
--- a/CefSharp.Wpf/ChromiumWebBrowser.cs
+++ b/CefSharp.Wpf/ChromiumWebBrowser.cs
@@ -63,6 +63,10 @@ namespace CefSharp.Wpf
///
private bool ignoreUriChange;
///
+ /// Initial address
+ ///
+ private readonly string initialAddress;
+ ///
/// Has the underlying Cef Browser been created (slightly different to initliazed in that
/// the browser is initialized in an async fashion)
///
@@ -463,6 +467,13 @@ namespace CefSharp.Wpf
}
}
+ public ChromiumWebBrowser(string initialAddress)
+ {
+ this.initialAddress = initialAddress;
+
+ NoInliningConstructor();
+ }
+
///
/// Constructor logic has been moved into this method
/// Required for designer support - this method cannot be inlined as the designer
@@ -1097,8 +1108,8 @@ namespace CefSharp.Wpf
{
SetCurrentValue(IsBrowserInitializedProperty, true);
- // If Address was previously set, only now can we actually do the load
- if (!string.IsNullOrEmpty(Address))
+ // Only call Load if initialAddress is null and Address is not empty
+ if (string.IsNullOrEmpty(initialAddress) && !string.IsNullOrEmpty(Address))
{
Load(Address);
}
@@ -1789,7 +1800,7 @@ namespace CefSharp.Wpf
var windowInfo = CreateOffscreenBrowserWindowInfo(source == null ? IntPtr.Zero : source.Handle);
//Pass null in for Address and rely on Load being called in OnAfterBrowserCreated
//Workaround for issue https://github.com/cefsharp/CefSharp/issues/2300
- managedCefBrowserAdapter.CreateBrowser(windowInfo, browserSettings as BrowserSettings, requestContext as RequestContext, address: null);
+ managedCefBrowserAdapter.CreateBrowser(windowInfo, browserSettings as BrowserSettings, requestContext as RequestContext, address: initialAddress);
browserSettings = null;
}