I have a very simple silverlight interface that has a bunch of links on it. Sort of like an old school html area map where different parts take you to different places on the internal network.
I was testing my pages in IE on a development box and was having success redirecting the page using
HtmlPage.Window.Navigate(New Uri("http://mytestbox02/"))
I took a copy of the source over to my laptop where the default browser for VS2010 happened to be Chrome and to my surprise my links did not work. Sometimes I saw it redirect but it mangled up the uri and it ended up being in the form of mytestbox02/ and therefore it didn’t go anywhere but 404 because it was missing the http:// prefix. Sometimes I get an exception. Details of that exception are
System.InvalidOperationException was caught
Message=SetProperty failed.
StackTrace:
at System.Windows.Browser.ScriptObject.SetProperty(String name, Object value)
at System.Windows.Browser.ScriptObject.GetObjectForSafari(IntPtr identity, IntPtr handle, Type type, Boolean releaseReferenceOnDispose)
at System.Windows.Browser.ScriptObject.GetObject(IntPtr handle, Type type, Boolean ownsHandle, Boolean releaseReferenceOnDispose)
at System.Windows.Hosting.ScriptingInterface.GetScriptParamValue(ScriptParam scriptParam)
at System.Windows.Hosting.ScriptingInterface.ConvertFromScriptParamAndDispose(ScriptParam scriptParam)
at System.Windows.Browser.ScriptObject.TryInvoke(String name, Object[] args, Exception& error)
at System.Windows.Browser.ScriptObject.Invoke(String name, Object[] args)
at System.Windows.Browser.HtmlWindow.Navigate(Uri navigateToUri, String target, String targetFeatures)
at System.Windows.Browser.HtmlWindow.Navigate(Uri navigateToUri)
at popupwindow.MainPage.ChildWindow_Closed(Object sender, EventArgs e)
InnerException:
Silverlight 4.1.10111.0 on both the dev box and my laptop.
Any clue what is going on here? I can’t be fully sure my clients will use IE so I hope there is a fix for this. Or something more cross-compatible that I can use other than window.navigate? I haven’t found anything yet though..
It seems that this may in fact be a Chrome issue – I just spent the day fighting it myself.
http://forums.silverlight.net/t/213769.aspx/1
http://stulic.blogspot.com/2009/08/javascript-locationhref-vs-silverlight.html
You’ll probably need to use some kind of javascript.