I'm having issues with cross-domain application hosting with Silverlight.
I have an application hosted in a different domain and including the following HTML code on a page:
<script type="text/javascript"> function succ( sender, args ) { console.log("SUCCESS"); console.log(sender); console.log(args); } function err( sender, args ) { console.log("FAILURE"); console.log(sender); console.log(args); } </script> <object width="400" height="20" id="app" type="application/x-silverlight-2" data="data:application/x-silverlight-2,"> <param name="minruntimeversion" value="4.0.41108.0"/> <param name="autoupgrade" value="false"/> <param name="onerror" value="err"/> <param name="onload" value="succ"/> <param name="enablehtmlaccess" value="true"/> <param name="source" value="http://example.com/app.xap"/> </object>
But if the app.xap application app.xap hosted in another domain from this HTML, the onLoad succ function is called without arguments, so it writes the following lines:
SUCCESS undefined undefined
If I am hosted in the same domain, it writes the correct lines:
SUCCESS UserControl {} undefined
So, in the first case, I could not get the annotated methods [ScriptableMember] from javascript, because I have no link to the application.
In the AppManifest.xml file AppManifest.xml I included the attribute required by the HtmlPage.RegisterScriptableObject method, like this:
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ExternalCallersFromCrossDomain="ScriptableOnly" > <Deployment.Parts> </Deployment.Parts> </Deployment>
The xap file xap transferred using application/x-silverlight-app Content-Type , so this is not a problem either.
What am I missing?
Thanks!