Skip to main content
Microsoft Silverlight
Home Forums Silverlight Programming Programming with JavaScript I can't read silverlight tag in IE !!
13 replies. Latest Post by Jonathan Shen – MSFT on August 21, 2009.
(0)
zenaxm
Member
0 points
7 Posts
08-08-2009 12:31 PM |
Here's a simple markup.
<div id="div1"> <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="640px" height="480px"> </object></div>
and executing alert(document.getElementById("div1").innerHTML); shows me
<OBJECT type=application/x-silverlight-2 height=480 width=640 data=data:application/x-oleobject;base64,QfXq3+HzJEysrJnDBxUISgAIAAAlQgAAnDEAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA></OBJECT>
And that means I can't upload silverlight contents via wysiwyg editor!! You can try to upload any silverlight contents in any forums that support wysiwyg editor. The result would be broken markup.
This is really a serious problem. I can't believe it is not issued much until now.(Someone else also described the issue here. http://silverlight.net/forums/t/21032.aspx)(I'm writing a yui editor's plug-in that enables silverlight content uploading and embedding.)
ken tucker
All-Star
18166 points
2,749 Posts
08-08-2009 1:45 PM |
wysiwyg editors do that to a lot of different types on content. Not just silverlight. I do not think this is an silverlight issue it is a problem with the editors.
08-08-2009 2:21 PM |
I can upload silverlight contents in firefox and chrome. I can't upload silverlight contents only in IE. So this is not the editor problem.
08-08-2009 2:50 PM |
One more example.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title></title> <script type="text/javascript" language="javascript"> function duplicateIt() { document.getElementById("div2").innerHTML = document.getElementById("div1").innerHTML; } </script> </head> <body onload="duplicateIt();"> <div id="div1"> <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="400px" height="400px"> <param name="source" value="http://www.silverlightshow.net/storage/userfiles/GlowEffect_RTW.xap"> <param name="background" value="white"> <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" style="border-style: none;"> </a> </object> </div> <div id="div2"> </div> </body> </html>
Try save and open this html using firefox, chrome and IE. Only IE doesn't duplicate the content.
chenaoxiang
2 points
1 Posts
08-10-2009 12:10 AM |
Really?? It is too bad!
Jonathan...
29213 points
2,831 Posts
08-14-2009 6:22 AM |
Hi Zenax,
Why do you want to copy the content like this way? This way works on Chrome but not with Firefox 3.5 and IE8. As a workaround, we need to go through the div's innerHTML. If there is a object tag, we use javascript to create it manually. However, it is a kind of pain. Another way is put all the controls inside the Silverlight application and copy the content on its code behind.
Best regards,
Jonathan
08-14-2009 2:59 PM |
I'm extending yui wysiwyg editor(http://developer.yahoo.com/yui/editor/) to allow site users to upload video.
1. user uploads a video file using ajax.2. when the upload completes, setup silverlight video player tag with proper parameters and insert it into the editor 3. call the editor's saveHTML() method on submit to copy the editor's content(which is in the iframe) to the textarea.
and at this point the markup is screwed up.
I've tested with FireFox 3.5.2 and and there was no problems. Only IE doesn't correctly copies the tag.
08-18-2009 2:40 AM |
Hi Zenaxm,
You'd better create a MediaElement and make it invisible. When we uploaded the video, we will get a url that indicates where the video is restored by WCF.
Now after we get the url, we can show the player and set its video source. To set its source, we can do it on code behind or Javascript. Another way is to use a Silverlight enabled Rich Editor and do all the things on code behind.
08-18-2009 12:13 PM |
We need to let our users to freely position the video in the post using rich text editor just like they upload and position the image.
There should be a way to correctly read silverlight tags, otherwise silverlight SUCKS. Contents that can't be dynamically manipulated? Is it a technology that developed before the DHTML? That doesn't make sense at all.
Can someone at microsoft at least tell me is it silverlight bug or ie bug?
08-19-2009 4:38 AM |
Actually, I think that are different behaviors between different browsers indeed. I tried to find something details but failed.
08-20-2009 10:11 AM |
Here's the blog posts that is posted using three different browsers.
http://zenaxm.blogspot.com/2009/08/posted-using-google-chrome.html (Google Chrome)
http://zenaxm.blogspot.com/2009/08/posted-using-firefox-3011.html (FireFox)
http://zenaxm.blogspot.com/2009/08/posted-using-ie7.html (IE)
The posts has a silverlight content and are written exactly the same way (I switched to 'edit html' mode and pasted the following markup and then switched back to normal rich text editing mode and saved it).
<object style="height: 250px; width: 200px;" type="application/x-silverlight" data="data:application/x-silverlight,"><param value="http://slkit.blob.core.windows.net/xaps/ToolkitBanner.xap" name="source"/><param value="true" name="windowless"/></object>
You can see that only IE didn't correctly save the post. The only way to include silverlight contents using IE is that write and save all the post contents using 'edit html' mode. In other words I should use plane textarea instead of rich text editor.
I cannot include anything that's silverlight in my blog post using IE. And you call it different browser behavior?
08-20-2009 11:51 AM |
The web html editor is suspose to break javascript and object tags for security reasons.
08-20-2009 12:41 PM |
It's broken simply because IE cannot copy the silverlight object tags correctly and it has nothing to do with security. All other browsers didn't cause problems.
08-21-2009 2:31 AM |
After I add style to the second div(set its width and height property), it works on Firefox 3.5. Then, I used Web Development helper to get the generated html and found that
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"> <param name="source" value="ClientBin/CopyXaml.xap"/> <param name="onError" value="onSilverlightError" /> <param name="background" value="white" /> <param name="minRuntimeVersion" value="3.0.40624.0" /> <param name="autoUpgrade" value="true" /> <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>
is encoded to:
<object width="100%" height="100%" data="data:application/x-oleobject;base64,QfXq3+HzJEysrJnDBxUISgAIAACTeAAAGhEAAAwAAAB3AGgAaQB0AGUAAAAAAAAAAAAAAAAAAAAuAAAAQwBsAGkAZQBuAHQAQgBpAG4ALwBDAG8AcAB5AFgAYQBtAGwALgB4AGEAcAAAADwAAAAAAAAAJgAAAG8AbgBTAGkAbAB2AGUAcgBsAGkAZwBoAHQARQByAHIAbwByAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAGAAAADMALgAwAC4ANAAwADYAMgA0AC4AMAAAAAoAAAB0AHIAdQBlAAAAAAAAAAAAAAAAAAAA" type="application/x-silverlight-2" altHtml=" <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> "/>
Therefore, IE has done something with the params in your case. You'd better post your question here. I will keep my eyes on this. Thanks.