问题
So if I have a flash object, like a youtube video, I can embed that on a website pretty easily (I think because that's flash, not necassarily youtube, maybe I'm wrong?).
I'd like to be be able to drop a silverlight object/embed tag (no javascript) on a static html page (like my blog, which is not the site with the xap file), and be done with it.
Basically it seems like there is zero way to do this unless you can add custom javascript to your site. I've found this link: http://msdn.microsoft.com/en-us/library/cc189089(VS.95).aspx.
Just really confused about this.
回答1:
You can do it with just an object tag. The JavaScript used in the MSDN example is to print any errors that occur while loading the application (though they usually just end up as warning in the browser's status bar).
The minimum snippet I would recommend might look like:
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
width="200px" height="200px">
<param name="source" value="URL/To/SilverlightApp.xap" />
<param name="minRuntimeVersion" value="2.0.31005.0" />
<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>
</object>
来源:https://stackoverflow.com/questions/816159/embedding-silverlight-anything-like-flash