如何在博客页面嵌入Silverlight控件?
如何在博客文章中嵌入用 Silverlight 编写的演示小程序?是否可以使用任何托管博客引擎或仅使用我自己托管的博客引擎来实现此目的?
我假设我需要使用与带有 SL 控件的常规 (X)HTML 页面相同的标签和 .js。是否有任何托管博客引擎允许我输入此内容? (blogger 可以吗?)
SL 安全模型是否意味着 XAP 文件需要托管在与博客页面本身相同的站点上?
How can I embed a demonstration applet written in Silverlight within a blog post? Is it possible to do so using any hosted blog engines, or only using a blog engine that I host myself?
I assume that I will need to use the same tags and .js as in a regular (X)HTML page with a SL control. Are there any hosted blog engines that will permit me to enter this? (Is it possible with blogger?)
Does the SL security model mean that the XAP file need to be hosted on the same site as the blog pages itself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用
在本例中,Silverlight 应用程序“MySLApp.xap”放置在与使用它的 HTML 页面相同的文件夹中。但是,如果您愿意,它可以位于不同的服务器上。然而,对 HTML Bridge 的访问将被阻止,但如果您的应用程序是独立的并且不需要与主机页面通信,那么就没有问题。
You can host a Silverlight app in HTML using the
<object>
tag, there is no need for the blog host to understand any of this. There is no server side element to hosting a Silverlight app its a purely client side thing.In this case the Silverlight app "MySLApp.xap" is placed in the same folder as the HTML page using it. However it could be on a different server if you like. However access to the HTML Bridge will be blocked but then if your app is self contained and does not need to communicate with the host page then there is no problem.
我创建了一个 Silverlight xap 来在我的 WordPress 主题中托管英雄图像或视频 - 我使用 initparams 和每个帖子的自定义字段将内容传递给它。
这样,我可以使用相同的 xap 来托管具有媒体控件的视频(如果适用)或具有酷淡入/点击效果的图像
示例图像帖子:
http://www.blackspike.com/site/html/display-google-docs-spreadsheets-in-wordpress
示例视频帖子 (点击视频查看控件):
http://www.blackspike.com/site/wpf/ hanselmans-babysmash
两者都使用相同的 xap!
I created a Silverlight xap to host hero images OR video in my wordpress theme - I pass the content to it using initparams and custom fields per post.
That way I can use the same xap to host videos with media controls if appropriate or images with cool fade ins/click effects
example image post:
http://www.blackspike.com/site/html/display-google-docs-spreadsheets-in-wordpress
example video post (click vid for controls):
http://www.blackspike.com/site/wpf/hanselmans-babysmash
Both using the same xap!
对我来说,一个简单的解决方案就是使用 iFrame。因此,我将 Visual Studio 生成的常规
TestPage.html
发布到我的网站(当然还有 .XAP 文件),然后嵌入它:使用 blogger,我发现了这个陷阱:任何尝试即使我使用“编辑 HTML”视图进行编辑,漂亮的 HTML(例如,将其拆分为单独的行)也会导致博主在输出中插入虚假的
标记。所以 iFrame 标签必须全部位于一行!!An easy solution that worked for me is just to use an iFrame. So I published the regular
TestPage.html
generated by Visual Studio to my web site (along with the .XAP file of course) and then embedded it:Using blogger, I discovered this gotcha: Any attempt to make the HTML pretty (e.g. by splitting it into separate lines) causes blogger to insert spurious
<br>
tags into the output, even if I do my edits using the "Edit HTML" view. So the iFrame tag must all be on a single line!!您可能需要检查主机是否映射了所需的 MIME 类型:
http://learn.iis.net/page.aspx/262/configuring-iis-for-silverlight-applications/
根据此 Server 2008 IIS7 应该开箱即用,但 IIS6 可能需要 MIME类型添加...
You might want to check your host has the required MIME types mapped:
http://learn.iis.net/page.aspx/262/configuring-iis-for-silverlight-applications/
according to this Server 2008 IIS7 should work out of the box but IIS6 may require MIME types adding...
如果 HTML 页面和 Silverlight xap 文件托管在同一服务器上,则上面标记为答案的解决方案效果很好。
因为在大多数情况下这是不可能的,因为大多数博主都使用博客/WordPress。我们没有任何方法可以在这些托管提供商上设置 MIME 类型。
这是一个很好的链接,详细解释了在 blogger 中托管 Silverlight 应用程序。
The solution marked as answer above works well if the HTML page and the Silverlight xap file are hosted on the same server.
As this is not possible in most of the cases, as most of the bloggers use either blogger/WordPress. We do not have any way of setting the mime type on these hosting providers.
Here is a good link which explains in detail regarding hosting an Silverlight application in blogger.