开发者

SWFobject - how to automatically redirect

开发者 https://www.devze.com 2022-12-16 21:04 出处:网络
Excuse me if this is an obvious question, How can you use SWFobject to automatically redirect to another URL -

Excuse me if this is an obvious question,

How can you use SWFobject to automatically redirect to another URL - NOT add an a href but physically load another URL ?

I'm using SWFobject 2 at the moment .

-- the SWFobject code ...

swfobject.embedSWF("MYSITE.swf", "myAlternativeContent", "850", "700", "9.0.0", false,开发者_如何学编程 flashvars, params, attributes);

--- 2 tricks I've tried in the myAlternativeContent DIV ...

1 ...

    <div id="myAlternativeContent">
          <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.NOFLASHSITE.com">
    </div>

2 ...

    <div id="myAlternativeContent">
          <script language="javascript" type="text/javascript">
            window.location="http://www.NOFLASHSITE.com";
          </script>
    </div> 

--- both of these load the alternative (http://www.NOFLASHSITE.com) regardless ..

any help is apreciated - MW


According to the SWFObject API, you could do something like this:

<script type="text/javascript">
swfobject.addLoadEvent(function() {
    if (!swfobject.hasFlashPlayerVersion("9.0.18")) {
        window.location = "http://www.NOFLASHSITE.com";
    }
});
</script>

Make sure that script block is in the <head> of your html file, and replace the "9.0.18" with whatever minimum version of flash you require.

0

精彩评论

暂无评论...
验证码 换一张
取 消