将Flash(swf)文件嵌入HTML(和XHTML)文档的最终方法是什么? [英] What's the ultimate way to embed Flash (swf) files to HTML (and XHTML) documents?

查看:215
本文介绍了将Flash(swf)文件嵌入HTML(和XHTML)文档的最终方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

像大多数人一样,我使用SWFObject来将Flash(swf)文件嵌入到我的Web项目中。 SWFObject提供了两种嵌入Flash的方法:静态发布和动态发布。

静态发布使用常规标记将文件嵌入到文档中,并使用JavaScript进行检查,而无法单独使用常规标记进行检查。如果您的客户不能打开JavaScript(搜索引擎,某些便携式设备...),这个文件仍然会显示出来(如果他们安装了正确的Flash插件)。但是,如果您的人员位于旧版/未修补的Internet Explorer( 2006年4月至2008年4月),他们将有可怕的点击激活与Flash交互。



动态发布使用JavaScript嵌入Flash。这将摆脱旧的IE浏览器的点击激活功能,但如果JavaScript关闭Flash将不会在那里。



这两种方法都有其优点和不便之处。在一个乌托邦的世界里,我们都会使用动态的发布方法,但是我们(或者至少我们中的一些人)和客户一起使用IE 6的老系统(他们想升级,但是他们不能很好地升级)设计的软件将花费10K + $升级)。我需要支持传统的IE浏览器,并希望摆脱点击激活功能,同时支持关闭JavaScript的人。



如何组合静态动态发布方法?那么像什么:

 <!DOCTYPE html PUBLIC -  // W3C // DTD XHTML 1.0 Strict // EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> 
< head>
< title> SWFObject 2静态+动态发布示例页面< / title>
< meta http-equiv =Content-Typecontent =text / html; charset = iso-8859-1/>
< script type =text / javascriptsrc =swfobject.js>< / script>
< script type =text / javascript>
swfobject.embedSWF(test.swf,myContent,300,120,9.0.0,expressInstall.swf);
< / script>
< / head>
< body>
< div id =myContent>
< object id =myIdclassid =clsid:D27CDB6E-AE6D-11cf-96B8-444553540000width =300height =120>
< param name =movievalue =test.swf/>
<! - [if!IE]> - >
< object type =application / x-shockwave-flashdata =test.swfwidth =300height =120>
<! - <![endif] - >
< div>
< h1>替代内容< / h1>
< p>< a href =http://www.adobe.com/go/getflashplayer>< img src =http://www.adobe.com/images/shared/ download_buttons / get_flash_player.gifalt =Get Adob​​e Flash player/>< / a>< / p>
< / div>
<! - [if!IE]> - >
< / object>
<! - <![endif] - >
< / object>
< / div>
< / body>
< / html>

我向一个集成商表明,他告诉我应该使用<对象> < embed> 标签...

什么将Flash嵌入到Web项目的最终方法?一个解决方案:


  • 可以使用JavaScript关闭(Flash嵌入到备用内容中)

  • 通过W3C验证器

  • 将删除遗留/未修补的IE上的点击激活
  • 将使用Flash检测/自动安装SWFObject



编辑:新增赏金。请,我不希望看到类似于不要打扰没有JavaScript关闭或如果JavaScript关闭最有可能的Flash也将关闭的答案。



编辑2:我正在寻找的答案是静态嵌入Flash(与常规的HTML标记)的最佳方式。在此之上,我将添加动态发布。 像这样,可以在自IE 6以后的所有主流浏览器中使用这将通过W3C验证。





解决方案

>

 <!DOCTYPE html PUBLIC -  // W3C // DTD HTML 4.01 // ENhttp://www.w3。组织/ TR / HTML4 / strict.dtd> 
< html lang =en>
< head>
< title>< / title>
< script type =text / javascriptsrc =swfobject.js> < /脚本>
< script type =text / javascript>
swfobject.embedSWF('test.swf','myFlash','320','240','9.0.0','/swfobject/expressInstall.swf',0,0,0);
< / script>
< / head>
< body>
< div>
< object id =myFlashclassid =clsid:D27CDB6E-AE6D-11cf-96B8-444553540000width =320height =240>
< param name =movievalue =test.swf>
<! - [if!IE]> - >
< object type =application / x-shockwave-flashdata =test.swfwidth =320height =240>
<! - <![endif] - >
< p>版本???< / p>
<! - [if!IE]> - >
< / object>
<! - <![endif] - >
< / object>
< / div>
< / body>
< / html>




  • 我将静态的 SWFObject

  • 静态部分使用嵌套对象方法

  • ul>

    Like most people I use SWFObject to embed Flash (swf) files to my Web projects.

    As you know SWFObject offers 2 ways to embed Flash: Static publishing and Dynamic publishing.

    Static publishing uses regular markup to embed the file to the document and also do checks with JavaScript that you can't make with regular markup alone. This is good as if you have customers that can't have JavaScript turned on (search engines, some portable devices...), the file will still show up (if they have the correct Flash plug-in installed). But if you have people on legacy/unpatched Internet Explorer (between April 2006 and April 2008) they will have the dreaded "click to activate" to interact with the Flash.

    Dynamic publishing uses JavaScript to embed the Flash. This will get rid of the "click to activate" feature on old IE but if JavaScript is off the Flash will not be there at all.

    Both methods have its advantages and inconvenients. In an utopic world we would all use the dynamic publishing method, but we (or at least some of us like me) are stuck with customers using really old systems with IE 6 (they would like to upgrade but they can't because of badly designed software that would cost 10K+$ to upgrade). I need to support legacy IE and want to get rid of the "click to activate" feature while supporting people with JavaScript off.

    What about combining static and dynamic publishing methods? What about something like:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
        <head>
            <title>SWFObject 2 static+dynamic publishing example page</title>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
            <script type="text/javascript" src="swfobject.js"></script>
            <script type="text/javascript">
            swfobject.embedSWF("test.swf", "myContent", "300", "120", "9.0.0", "expressInstall.swf");
            </script>
        </head>
        <body>
            <div id="myContent">
                <object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="120">
                    <param name="movie" value="test.swf" />
                    <!--[if !IE]>-->
                    <object type="application/x-shockwave-flash" data="test.swf" width="300" height="120">
                    <!--<![endif]-->
                    <div>
                        <h1>Alternative content</h1>
                        <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
                    </div>
                    <!--[if !IE]>-->
                    </object>
                    <!--<![endif]-->
                </object>
            </div>
        </body>
    </html>
    

    I showed that to an integrator and he told me I should use <object> and <embed> tags...

    What would be the ultimate way to embed Flash to Web projects? A solution that:

    • Will work with JavaScript off (Flash embedded in alternate content)
    • Will pass the W3C validator
    • Will remove the "click to activate" on legacy/unpatched IE
    • Will use the Flash detection/auto-install of SWFObject

    EDIT: Added bounty. Please, I don't want to see answers like "don't bother no one have JavaScript off nowdays" or "if javascript is off most likely Flash will be off too".


    EDIT 2: The answer I'm looking for is the best way to embed Flash statically (with regular HTML tags). Over that, I will add dynamic publishing. Something like this that will work in all major browsers since IE 6 and that will pass W3C validation.


    解决方案

    Here it is:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
        <head>
            <title></title>
            <script type="text/javascript" src="swfobject.js"> </script>
            <script type="text/javascript">
                swfobject.embedSWF('test.swf', 'myFlash', '320', '240', '9.0.0', '/swfobject/expressInstall.swf', 0, 0, 0);
            </script>
        </head>
        <body>
            <div>
                <object id="myFlash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="240">
                    <param name="movie" value="test.swf">
                    <!--[if !IE]>-->
                    <object type="application/x-shockwave-flash" data="test.swf" width="320" height="240">
                    <!--<![endif]-->
                        <p>Version ???</p>
                    <!--[if !IE]>-->
                    </object>
                    <!--<![endif]-->
                </object>
            </div>
        </body>
    </html>
    

    这篇关于将Flash(swf)文件嵌入HTML(和XHTML)文档的最终方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆