I have a number of Silverlight apps hosted in an ASP.Net Web Forms Application based on the Navigation Application template. My company has upgraded to IE11 and we are now experiencing the "White Screen of Death" on browser refreshes and after using the Back button. A lot of searching has me believing that the only way to solve the WSOD is to replace the object tag that I'm using with JavaScript to load it during the onload event of the html body. While it does appear to fix the WSOD, when I navigate to other pages, the url in the browser does not update, therefore the Back button navigates to the previous web page (not Silverlight page). It appears the the generated html tag differs a bit - possibly most significantly by the "application/x-silverlight" vs. "application/x-silverlight-2" - I did note that the Silverlight.js file does contain the "-2", so I'm not sure why the output does not use it.
Has anyone dealt with this before and come up with a workaround?
Original code:
<div id="silverlightControlHost" style="padding:0px;">
<object id="SilverlightClientControl" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="<%=GetXapLocation()%>"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.60129.0" />
<param name="autoUpgrade" value="true" />
<param name="initparams" id="initParams" runat="server" value="<%=GetInitialParams()%>"/>
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60129.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object>
<iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
</div>
Updated JavaScript version (function called in onload event of body tag):
function createSL() {
Silverlight.createObjectEx({
source: "<%=GetXapLocation()%>",
parentElement: document.getElementById("silverlightControlHost"),
id: "SilverlightClientControl",
properties: {
background: "white",
version: "4.0.60129.0",
height: "100%",
width: "100%"
},
events: {
onError: onSilverlightError
},
initParams: "<%=GetInitialParams()%>"
});
}
html generated by object tag:
<object width="100%" height="100%" id="SilverlightClientControl" data="data:application/x-oleobject;base64,***long string of characters***"
type="application/x-silverlight-2">
<param name="source" value="/ClientBin/TicketMaintenance.xap?9/24/2015 3:51:25 PM">
<param name="onError" value="onSilverlightError">
<param name="background" value="white">
<param name="minRuntimeVersion" value="4.0.60129.0">
<param name="autoUpgrade" value="true">
<param id="initParams" name="initparams" value="MATaxFreeStartDate=8/15/2015, MATaxFreeEndDate=8/16/2015">
<a style="text-decoration: none;" href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60129.0">
<img style="" alt="Get Microsoft Silverlight" src="http://go.microsoft.com/fwlink/?LinkId=161376">
</a>
</object>
html generated by the JavaScript:
<object width="100%" height="100%" id="SilverlightClientControl" data="data:application/x-oleobject;base64,***long string of characters***"
type="application/x-silverlight">
<param name="background" value="white">
<param name="source" value="/ClientBin/TicketMaintenance.xap?9/24/2015 3:51:25 PM">
<param name="initParams" value="MATaxFreeStartDate=8/15/2015, MATaxFreeEndDate=8/16/2015">
<param name="onError" value="__slEvent0">
</object>
Related
I have one page with a Silverlight object on it, and many times when visiting the page, there is between .1-2 seconds where the previous screen's content is frozen inside the box where the Silverlight object should be, before Silverlight starts loading with the 1-99% progress circle. I'm using Chrome. It is very sloppy looking loading. I image the problem might go unnoticed after the first cache, but is there any way to avoid this visual remnant?
<div id="silverlightControlHost" style="height:440px; padding-top:15px" >
<object name="slupload" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="440px" height="100%" >
<param name="source" value="../ClientBin/SilverlightWebcam.xap?#nocache"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.41108.0" />
<param name="autoUpgrade" value="true" />
<param name="onLoad" value="pluginLoaded" />
<param name="initParams" value="userid=#ViewBag.UserID" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.41108.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
Try changing the visibility of the Silverlight object with Javascript so that it appears after the page has loaded/rendered.
<div id="silverlightControlHost" >
<object id="idThObject" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/MySolution.xap"/>
<!--<param name="source" value="http://www.mysite.com/ClientBin/MySolution.xap"/> **NOT WORK**-->
...
</div>
Hi to ALL !
My Silverlight object exist on sever side in folder and when I try to load it like this : <param name="source" value="http://www.mysite.com/ClientBin/WebSolution.xap" />
This is doesn't work, but it I load this locally :
<param name="source" value="ClientBin/MySolution.xap"/>, it's work fine.
So what can I do to load my *.xap file from server or I don't have any chance to do it ?
Please check that you have added the required mimetypes for silverlight in IIS on the server.
map the following.
.xap application/x-silverlight-app
.xaml application/xaml+xml
.xbap application/x-ms-xbap
I didn't change any values of any type in html code. Visual Studio 2010 create standard template :
<div id="silverlightControlHost" style="font-size: small;color: red;">
<object id="idThObject" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/WebSolution.xap"/>
<param name="onerror" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40818.0" />
<param name="autoUpgrade" value="true"
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
</a>
</object><iframe id='_sl_historyFrame' style='visibility:hidden;height:0;width:0;border:0px'></iframe></div>
Only one point : provider of my site yahoo.com. So by default this guys don't use IIS.
So you think this is problem ? That Apache doesn't know this :
< ...data="data:application/x-silverlight," type="application/x-silverlight-2"/>
look like I have to move to another provider, which support IIS.
I have a Silverlight Application (SL4) which I have rolled out to people within my network. The problem I have is that when some of my users go to access the SL application it is asking them to download a Silverlight 3 plug in.
Is there something I need to set in my Project to ensure that the Plug in installs SL4.
Sounds like the host page HTML is incorrectly set. Your object tag HTML ought to look like this:-
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/SilverlightApplication1.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.60310.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60310.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
</div>
Note in particular the minRuntimeVersion param and the "&v=4.0.60310.0" query string value of the href in the object fallback content.
We recently added a small silverlight client that loads on every page load.
However for the visitors who for some reason don`t want to upgrade their silverlight version they are seeing this annoying message on every single page load:
From where is this alert triggered and how can I stop it from being triggered? Ive looked in the silverlight.js file but cant find it.
Following is the code where the Silverlight app is embeded:
<div id="silverlightControlHost">
<script type="text/javascript" src="http://$CommonHelps.GetSiteInfoByDomain().ContentDomainJavascript/Silverlight.js"></script>
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="5" height="5" >
<param name="source" value="/ClientBin/AppLaunch.Bloc.Frontend.SilverLight.UserOnlineClient.xap"/>
<param name="onError" value="AppLaunch.Chatbar.onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40818.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" target="_blank">
Install silverlight to chat with your friends
</a>
</object>
<iframe id="_sl_historyFrame"></iframe>
</div>
<p id="UserOnlineClientConnectionClientEx"></p>
Tim Heuer blogged the answer to this a while ago in his silverlight 3 beta install guidance blog post. You need to make sure you have minRuntimeVersion with a minimum version, autoUpgrade param set to false, and onerror param set to a javascript function, such as below:
<param name="minRuntimeVersion" value="3.0.40307.0" /><param name="autoUpgrade" value="false" /><param name="onerror" value="pluginError" />
You then need the js error function, called pluginError above to check for errorCode 8001. Set what you want the user to see within that if statement. This stops the popup!
I have a Silverlight app that has to load an image dynamically, depending on the image name. The approach that im taking right now is passing the image name by query string to the page and passing that as a param to the Silverlight objet tag
This is the query string passed
Response.Redirect("Build.aspx?img=" + this.PictureUploader.PostedFile.FileName;
And I try to pass it to Silverlight like this:
<object id="SilverlightObject" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="Silverlight/iMapsSL.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40624.0" />
<param name="autoUpgrade" value="true" />
<param name="image" value="<%# Request.QueryString["img"] %>" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
in the last param tag with name=image value= Requerst.QueryString
I catch the image inside the Silverlight app like this
private void Application_Startup(object sender, StartupEventArgs e)
{
string pictureName = "";
if (e.InitParams != null && e.InitParams.Count > 0)
{
pictureName = e.InitParams["image"];
this.RootVisual = new MainPage(pictureName);
}
else
{
this.RootVisual = new MainPage();
}
}
And when MainPage starts, I set the image source of the Image control like this
this.Image.Source = new BitmapImage(new Uri(pictureName, UriKind.RelativeOrAbsolute));
But Silverlight loads without an image, any help someone?
You can't set arbitary values to by inventing a param names like "image". InitParams are created by specifying the "initparams" param. The "initparams" value is a comma delimited set of name=value pairs. Hence your code should look like:-
<object id="SilverlightObject" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="Silverlight/iMapsSL.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40624.0" />
<param name="autoUpgrade" value="true" />
<param name="initparams" value="image=<%# Request.QueryString["img"] %>" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>