在HTML5中嵌入SWF文件 - 如何添加替代内容?(Embedding SWF file in HTML5 - How to add alternative content?)
我想在HTML5中嵌入一个SWF文件。 它适用于以下代码:
但是,如果不支持swf文件(并且仍然在w3中验证!),我怎么能显示替代内容(动画GIF图像,或静态JPEG或PNG))
谢谢!
I'd like to embed an SWF file in HTML5. It works fine with this code:
But how could I show alternative content (an animated GIF image, or a static JPEG or PNG) just in cases which swf file is not supported (and still validating in w3! ;) )
Thank you!
原文:https://stackoverflow.com/questions/25489827
更新时间:2020-02-24 22:17
最满意答案
使用object标签代替embed标签,如下所示: Alertnative Content Here
Use the object tag instead of the embed tag like so: Alertnative Content Here
相关问答
将SWF嵌入HTML页面的最佳方法是使用SWFObject 。 它是一个简单的开源JavaScript库,易于使用和标准友好的嵌入Flash内容的方法。 它还提供Flash播放器版本检测。 如果用户没有Flash版本或禁用JavaScript,他们将看到一个替代内容。 您也可以使用此库来触发Flash Player升级。 一旦用户升级,它们将被重定向回到页面。 文档的一个例子: ext/javascript">
var flashvars = {};
var params = {wmode : "transparent"};
var attributes = {};
swfobject.embedSWF("myContent.swf", "myC
...
Flash可以输出SVG。 检查这些谷歌搜索结果 ,然后向外包设计师提出建议。 如果它们是最新版本,则内置此功能: 请参阅视频指南 如果他们使用CS 5 / CS 5.5或CS 6,他们可以尝试这个附加组件: Flash 2 SVG Flash can output SVG. Check these google results and then suggest something to your outsourced designer. If they are on the latest ver
...
您可以随时向他们发送PDF,因为PDF支持交互式表单。 您需要一份Acrobat(或类似的工具,这里有其他选择),您的用户需要Acrobat Reader的免费副本。 可以将结果作为PDF或XML格式发送以进行处理。 PDF表单验证非常先进,可以包含Javascript。 You could always send them a PDF instead, since PDFs support interactive forms. You'd need one copy of Acrobat (or
...
最后用js做了,我使用以下函数来计算基于我希望嵌入元素的容器的新尺寸。 /* Calculates the new scaled dimensions
* srcWidth: Swf real width
* srcHeight: Swf real height
* maxWidth: Container's width
* maxHeight: Container's height
*/
function calculateAspectRatioFit (srcWidth, src
...
对于它的地狱,这里是一个广泛的SWFObject我生成的工作(虽然矫枉过正): var SWFObject = document.createElement("object");
SWFObject.setAttribute("type", "application/x-shockwave-flash");
SWFObject.setAttribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
SWFObject.setAt
...
只有当您从本地驱动器加载页面时,才会弹出这些警告 - 而不是从服务器加载页面时。 这不仅仅是闪光 - 即使你的网页中有一些JavaScript,这些警告也会弹出。 These warnings will pop up only when you load the page from local drive - not when you load the page from a server. And it's not just for flash - these warnings pop up e
...
我使用这个过程解决了嵌入式.swf的问题: 使用Swiffy将master .swf文件转换为.html文件。 使用Dev Tools我能够看到转换后的.swf主文件正在寻找嵌入的.swf文件作为.swf.json文件。 我通过Swiffy运行嵌入的.swf文件,将它们转换为.html文件。 打开.html文件,你会在标题的JS代码中看到一个swiffyobject 。 swiffyobject是一个JSON格式的对象。 复制对象 - {}所有内容,包括括号。 将对象粘贴到新文件中,保存文件并将.
...
使用object标签代替embed标签,如下所示: Alertnative Content Here 请参阅: EMBED与OBJECT Use the object tag instead of the embed tag like so: Alertnative Content He
...
使用嵌入HTML代码:
源码教程:html5嵌入flash元素 Use embed in your HTML code :
source tutorial: html5 embed flash element