Those functions accept configuration details as input parameters and generate equivalent HTML object elements. Let's start describing more about this with a simple example to help you to understand it better.
Embedding Silverlight Application using <object /> TagBy default when you create a Silverlight project, it creates a Web hosting project for you too. In that project you will find one html file and one aspx file where we have the following code to host the Silverlight application:
<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="Iframe1" style="visibility: hidden; height: 0px; width: 0px; border: 0px"> </iframe> </div>
The <object /> tag creates the object of the Silverlight plugin and embeds your application inside it. You can add proper param tags inside it to set recommended parameters for your application.
The createObject() method takes XAP file path as source, the second parameter takes the parent control name which is hosting the Silverlight plug-in, the third parameter takes the generated object element ID, the fourth parameter specifies an array of property values, the fifth parameter specifies an array of event handlers, the sixth parameter specifies a string that contains name and value pairs as params separated by commas and the last parameter specifies a value that you can use to uniquely identify the generated plug-in instance in an OnLoad event handler.
Now when you launch the application in browser window, the page script will generate the object dynamically and embed it to itself, which will load the mentioned XAP in the web page.
Last but not least, connect with me on Twitter and Facebook for technical updates and articles news. Also subscribe to my blog’s Newsletter to get all the updates delivered directly to your inbox. We won’t spam or share your email address as we respect your privacy.
If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter, Facebook, Google+ and LinkedIn. I would love to hear your thoughts and opinions on my articles directly. Also, don't forget to share your views and/or feedback in the comment section below.