Skip to main content
Home Forums General Silverlight Getting Started Do I need Silverlight.js file?
4 replies. Latest Post by amyd on October 15, 2008.
(0)
dsr9996
Member
11 points
3 Posts
10-15-2008 3:07 PM |
Hi silverlight devs,
I developed a game using Silverlight 2 (beta 2) and have been playtesting it on my website, using the test html page generated for me from the silverlight solution's web project. I just upgraded to the released version of Silverlight 2 (including the dev tools of course), rebuilt my app without problems, then knew I needed to update my html page to include the correct link to Microsoft's released Silverlight version (rather than the link to the beta 2 version of the SL runtime).
So to get the new link, I just created a new Silverlight 2 solution in Visual Studio, then opened the generated html page, pulled out the correct link to the released runtime version, and pasted that into my existing page over the old beta 2 link.
However, I noticed that in the new solution there was a Silverlight.js file created and the new html page referenced it:
<script type="text/javascript" src="Silverlight.js"></script>
My existing html page didn't reference this file (nor did I copy it to my server). Do I need to?
I haven't run into any problems but are people who come to my site without silverlight going to have problems? Help!
amyd
722 points
124 Posts
10-15-2008 3:23 PM |
Silverlight.js ships with the SDK and has some client side scripting so you can detect whether or not your user has Silverlight installed and dynamically write the object tag or the install symbol.
You can alternatively just write out the object tag, or if you're using aspx, you can use the asp:Silverlight control
10-15-2008 3:29 PM |
Thanks for your reply. I think I understand what you are saying, and I think I am using the "object" tags. Here is the snippet from my html page:
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="750px" height="480px"> <param name="source" value="ClientBin/TowerDefenseAStarGuruSilverlight.xap"/> <param name="onerror" value="onSilverlightError" /> <param name="background" value="white" /> <param name="minRuntimeVersion" value="2.0.31005.0" /> <param name="autoUpgrade" value="true" /> <p class="style2">Ooh, you are almost ready to repel the alien invaders, all you need is Microsoft's Silverlight plugin; click the image below to get it</p>
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/> </a> <p class="style2">Here's a screenshot from the game:</p> <img src="mtnscreen.JPG" alt="Mountain Pass Tower Defense screenshot"/> </object>
Is this what you mean by using the object tag?
Thanks!
Bill Reiss
Contributor
4822 points
915 Posts
10-15-2008 3:32 PM |
It used to be important, one reason was because in IE unless you used javascript to write the object tag you would get the "click to activate" stuff. Microsoft settled this patent issue and a patch went out for IE7 to remove this. There are some cool things in it to refresh the page on install automatically but I think some of this may have been wrapped into the asp:Silverlight control.
So overall, I'd say most people won't need to use Silverlight.js
10-15-2008 3:34 PM |
dsr9996: Is this what you mean by using the object tag?
Yep