Results 1 to 2 of 2

Thread: Flash Page Redirect if no Flash Plugin

  1. #1
    Join Date
    Mar 2010
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Flash Page Redirect if no Flash Plugin

    Good Afternoon,

    I have a flash intro http://kuraldesign.com/beta/kd/ that needs a redirect to http://kuraldesign.com/beta/kd/home.html if there is no flash plugin i.e. iphone.

    Thanks
    Karl

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,920
    Thanks
    43
    Thanked 3,187 Times in 3,151 Posts
    Blog Entries
    12

    Default

    I dont't know about the iphone. I'm sure there are other situations where Flash may not be present. Basically what you need is a way to detect Flash, perhaps even a minimum Flash version.

    Now, you've posted this in javascript, or at least that's where I found it. If we use javascript, users without javascript enabled/available will not benefit from whatever we do here, unless we add some HTML into the mix.

    Here's a javascript Flash version detection routine:

    Code:
    /* Flash Version Detect Script 2010 John Davenport Scheuer
       as first seen in http://www.dynamicdrive.com/forums/
       username: jscheuer1 - This Notice Must Remain for Legal Use
       */
    
    function detectFlashVersion(v){
    	var flashVersionIsInstalled = false;
    	if(typeof ActiveXObject !== 'undefined'){
    		// Check ActiveXObject for Flash version capability
    		/*@cc_on @*/
    		/*@if(@_jscript_version >= 5)
    			try {
    				flashVersionIsInstalled = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.' + v);
    			} catch (e) {}
    		@end @*/
    		if(flashVersionIsInstalled){
    			flashVersionIsInstalled = true;
    		}
    	} else {
    		// Check navigator.plugins for "Shockwave Flash"
    		var p = navigator.plugins, i = p.length - 1, re = /Shockwave Flash/;
    		for (i; i > -1; --i){
    			if(re.test(p[i].name)){
    				flashVersionIsInstalled = p[i];
    				break;
    			}
    		}
    		if(flashVersionIsInstalled){
    			flashVersionIsInstalled = parseInt(flashVersionIsInstalled['description'].replace(/[^\d\.]/g, '')) >= v;
    		}
    	}
    	return flashVersionIsInstalled;
    }
    It will return false if the user doesn't have at least the minimum specified version of Flash installed, which includes returning false if there is no Flash installed. To get it to redirect to another page, do (for Flash 8, a popular minimum Flash version for many things):

    Code:
    if(!detectFlashVersion(8)){
    	location.replace('http://kuraldesign.com/beta/kd/home.html');
    }
    Optional Extra Stuff for Dealing with Users with no Javascript:

    As for dealing with users that don't have either Flash or javascript, here's one way - Make your Flash tag like:

    Code:
    <object id="thePlayer" type="application/x-shockwave-flash" style="height:250px;width:300px;" data="pathto/flash.swf">
    <param name="movie" value="pathto/flash.swf">
    <param name="allowFullScreen" value="false"><!-- optional -->
    <param name="wmode" value="transparent"><!-- optional -->
    <param name="allowscriptaccess" value="always"><!-- optional -->
    <param id="network" name="allowNetworking" value="external"><!-- optional -->
    <div>
    Failure - Adobe Flash Application Failure. Make sure you have the latest version player:<br><a target="_blank" href="http://get.adobe.com/flashplayer/" title="Get Free Adobe Flash Player">Free Adobe Flash Player</a><br>&nbsp;<br>Or, You may skip this Flash intro and go to the Home page:<br><a href="http://kuraldesign.com/beta/kd/home.html" title="Skip Flash Intro">Home</a>
    </div>
    </object>
    Just be sure to replace the two highlighted sections with the actual path to your Flash file, and to set its actual height and width in the style attribute.
    Last edited by jscheuer1; 04-23-2010 at 03:48 AM. Reason: remove superfluous variable 'control'
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •