2011-08-08 73 views
0

我很困惑這個我有一個完整的Flash網站和一個HTML5網站(在Hype中製作) 我想要的是索引文件來檢測Flash是否安裝,如果是的話去flashsite,如果沒有,那麼它應該加載html網站。 這是我的索引文件。我在哪裏放置重定向代碼? 在此先感謝。檢測是否安裝了閃存並重定向到其他域名

<meta http-equiv="content-type" content="text/html; charset=UTF-8"> 

<link href="style.css" rel="stylesheet" type="text/css"> 
</head> 
<body> 
<table style="width:766px;height:750px" align="center"> 
<tr> 
<td> 
<object classid="00000000000000000000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" 
    width="766" height="750"> 
    <param name="movie" value="flash/main_v7.swf"> 
    <param name="quality" value="high"> 
    <param name="menu" value="false"> 
    <!--[if !IE]> <--> 
    <object data="flash/main_v7.swf" 
    width="766" height="750" type="application/xshockwave-flash"> 
    <param name="quality" value="high"> 
   <param name="menu" value="false"> 
    <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer"> 
    <!--FAIL (the browser should render some flash content, not this).--!> 
    </object> 
    <!--> <![endif]--> 
    </object> 
    </td> 
    </tr> 
    </table> 
    </body> 
</html>` 

回答

0

你可以在頁面加載使用JavaScript detect flash,如果沒有檢測到閃重定向。

0

您可能想要使用SWFObject加載和顯示Flash文件。你有很多可能性來控制你的瑞士法郎。

此外,它會爲您提供一個鉤子來檢測缺少的Flash插件。你可以在那裏放置一個錨標籤或你的重定向代碼,你很好去。

首先,你的swf需要一個容器。如果安裝了Flash,則此容器的內容將被覆蓋。如果未檢測到閃光燈,容器將保持原樣。

<div id="swfContainer"> 
    <!-- no flash installed... --> 
    <script> 
    document.location.href = "somewhereelse.html"; 
    </script> 
</div> 

然後使用Javascript插入你的SWF:

<script type="text/javascript" src="swfobject.js"></script> 
<script type="text/javascript"> 
    // no need to get fancy here... 
    var flashvars = {}; 
    var params = {}; 
    var attributes = {}; 

    swfobject.embedSWF("test.swf", "swfContainer", "300", "120", "9.0.0", false, 
         flashvars, params, attributes); 
</script> 
1

貌似這個謎底之前得到答覆:

https://stackoverflow.com/questions/998245/how-can-i-detect-if-flash-is-installed-and-if-not-display-a-hidden-div-that-info

希望這會有所幫助。

相關問題