Skip to main content
Home Forums Silverlight Programming Programming with .NET - General "click to activate and use this control" on IE for Silverlight 2.0 page
7 replies. Latest Post by rajesh shirpuram on August 11, 2008.
(0)
sladapter
All-Star
17439 points
3,172 Posts
03-07-2008 11:25 AM |
I keep getting "click to activate and use this control silverlight control" message when first load a silverlight 2.0 page on IE. It is very annoying. How can I get rid of this? I don't remember seeing this with Silverlight 1.1.
cschuman
Member
210 points
55 Posts
03-07-2008 11:29 AM |
There are some JavaScript libraries out there. Check Google for them: http://www.google.com/search?q=click+to+activate+javascript&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
m.wawrusch
20 points
15 Posts
03-07-2008 11:38 AM |
Use the aspx Silverlight wrapper instead of instantiating the Silverlight object directly. That should do the trick.
HTH
Martin
frefaln
153 points
74 Posts
03-07-2008 1:44 PM |
Assuming you don't have a specific need to use the <object> tag in your HTML markup, here's how to avoid that nasty "click to activate" message (thanks Eolas):
- In your web site add a reference to System.Web.Silverlight.
- On your .aspx/.ascx add the following directive:
<%
- Then in your markup you'd add:
Hope this helps.
jackbond
Contributor
2820 points
725 Posts
03-07-2008 2:25 PM |
sladapter:It is very annoying. How can I get rid of this?
Well since you don't mind using beta software, there is a beta update to IE that gets rid of the Eolas blackmail work around, i.e. you don't have to "Click to Activate" anything.
http://support.microsoft.com/kb/947518
03-07-2008 4:02 PM |
Update browser can only work for me as a developer. But I want to show my boss how the silverlight works. They would be pissed off if they have see that "click to activate and use this control" message everytime to load a page.
Anyway, this message only happens when I use the SilverlightTestPage.htm as test page. I can use SilverlightTestPage.aspx to test so I would not get that annoying message. But I found some other problems with using aspx page to test. Like getting a runtime error when a image control does not have a valid source file.
So I modified SiverlightTestPage.htm file as following:
<div id="silverlightControlHost"> <!-- Change the object tag to script tag --> <script type="text/javascript"> var objscript = '<object data="data:application/x-silverlight," type="application/x-silverlight-2-b1" width="100%" height="100%">'; objscript += '<param name="source" value="ClientBin/MyTest.Silverlight.xap"/>' objscript += '<param name="onerror" value="onSilverlightError" />' objscript += '<param name="background" value="white" />' objscript += '<a href="http://go.microsoft.com/fwlink/?LinkID=108182" style="text-decoration: none;">' objscript += '<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>'; objscript += '</a>'; objscript += '</object>'; </script>
<!-- The document.write(objscript) line has to be in a separate javascript include file --> <script type="text/javascript" src="JavaScript/fixit.js"></script> <iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe> </div>
the fixit.js only contains one line of code: document.write(objscript);
This works fine now. Thanks for all the suggestions.
WilcoB
720 points
137 Posts
03-10-2008 1:02 PM |
If you installed the Silverlight SDK, you can use the Silverlight.js script that was previously used by default. You can find this file somewhere in Program Files/Microsoft SDKs/Silverlight/v2.0.
rajesh s...
2314 points
505 Posts
08-11-2008 8:27 AM |
Thanks sladapter for this solution...