Solved

Detecting Flash Player and version as well as browser

Posted on 2009-05-19
4
683 Views
Last Modified: 2013-11-11
I am trying to run two different falsh elements on a page.  One is contained with in a layer tag and sits on top of the other part way. This become a problem with some browsers and then does not work properly (buttons with in the bottom flash element will not work). Currently I'm using Adobe / Flash default detection in case a user does not have flash. I also think I am running this code twice to make this work. I need a better way to run ether the Falsh or the HTML code. I need some code that will detect the users flash version, then  detect what browser the user is using. These factors will then determine what block of code is to be ran.

This is a PHP page so a conditional using PHP my work but I don't have a clue on how to write it.

Help would be greatly appreciated!

Thanks!
<!-- Adobe flash Java Script -->
<script language="javascript"> AC_FL_RunContent = 0; </script>
<script language="javascript"> DetectFlashVer = 0; </script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 115;
// -----------------------------------------------------------------------------
// -->
</script>
 
<!-- other code... then the two blocks of fash -->
 
<table cellpadding="0" cellspacing="0" style="width:900px;" align="center">
      <tr>
        <td rowspan="2" valign="top" align="center" style="width:650px;"><!-- start flash billboard -->
              <script language="JavaScript" type="text/javascript">
					<!--
					if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
						alert("This page requires AC_RunActiveContent.js.");
					} else {
						var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
						if(hasRightVersion) {  // if we've detected an acceptable version
							// embed the flash movie
							AC_FL_RunContent(
								'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
								'width', '634',
								'height', '238',
								'src', 'billboard_as2',
								'quality', 'high',
								'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
								'align', 'middle',
								'play', 'true',
								'loop', 'true',
								'scale', 'showall',
								'wmode', 'transparent',
								'devicefont', 'false',
								'id', 'billboard_as2',
								'bgcolor', '#ffffff',
								'name', 'billboard_as2',
								'menu', 'true',
								'allowScriptAccess','sameDomain',
								'allowFullScreen','false',
								'movie', 'billboard_as2',
								'salign', ''
								); //end AC code
						} else {  // flash is too old or we can't detect the plugin
							var alternateContent = '<table style="background-image:url(images/billboard_bg.gif); background-repeat:repeat-x; width:634px; height:238px; border-style:solid; border-width:thin; border-color:#666666" cellpadding="0" cellspacing="0"><tr><td valign="middle"><table align="center" cellpadding="0" cellspacing="0"><tr><td rowspan="6"><a href="Honda-Vehicles-2010/colorado-insight.php"><img src="images/insight-billboard.jpg" alt="Honda Insights Colorado Car Dealer" name="Image28" width="514" height="220" border="0"></a></td><td align="center" valign="middle"><a href="Honda-Specials/dealer-specials.php"><img src="images/specials-bil.jpg" alt="Honda Vehicle Dealership Specials" name="Image29" width="96" height="30" border="0" hspace="3" vspace="4"></a></td></tr><tr><td align="center" valign="middle"><a href="2009-Honda-Vehicles/new-cars.php" ><img src="images/new-vehicle-bil.jpg" alt="New Honda Cars SUVs Vans"  width="96" height="30" border="0" hspace="3" vspace="4"></a></td></tr><tr><td align="center" valign="middle"><a href="used-cars/pre-owned-vehicle.php"><img src="images/used-cars-bil.jpg" alt="Used Cars Honda Pre-Owned vehicles" name="Image31" width="96" height="30" border="0" hspace="3" vspace="4"></a></td></tr><tr><td align="center" valign="middle"><a href="vehicle-financing/vehicle-financing.php"><img src="images/car-credit-bil.jpg" alt="Car Credit Automotive financing" name="Image32" width="96" height="30" border="0" hspace="3" vspace="4"></a></td></tr><tr><td align="center" valign="middle"><a href="Honda-Service/honda-service.php" ><img src="images/Honda-Service-bil.jpg" alt="Honda Car Service" name="Image33" width="96" height="30" border="0" hspace="3" vspace="4"></a></td></tr><tr><td align="center" valign="middle"><a href="Honda-Parts/honda-parts.php"><img src="images/Honda-Parts-bil.jpg" alt="Honda Parts and Accessories" name="Image34" width="96" height="30" border="0" hspace="3" vspace="4"></a></td></tr></table></td></tr></table>';
							document.write(alternateContent);  // insert non-flash content
						}
					}
					// -->
					</script>
              <noscript>
                <table style="background-image:url(images/billboard_bg.gif); background-repeat:repeat-x; width:634px; height:238px; border-style:solid; border-width:thin; border-color:#666666" cellpadding="0" cellspacing="0">
              <tr>
              	<td valign="middle">
                <table align="center" cellpadding="0" cellspacing="0">
                	<tr>
                    	<td rowspan="6"><a href="Honda-Vehicles-2010/colorado-insight.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image28','','images/insight-billboard_d.jpg',1)"><img src="images/insight-billboard.jpg" alt="Honda Insights Colorado Car Dealer" name="Image28" width="514" height="220" border="0"></a></td>
                    	<td align="center" valign="middle"><a href="Honda-Specials/dealer-specials.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image29','','images/specials-bil-d.jpg',1)"><img src="images/specials-bil.jpg" alt="Honda Vehicle Dealership Specials" name="Image29" width="96" height="30" border="0" hspace="3" vspace="4"></a></td>
                    </tr>
                    <tr>
                    	<td align="center" valign="middle"><a href="2009-Honda-Vehicles/new-cars.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image30','','images/new-vehicle-bil-d.jpg',1)"><img src="images/new-vehicle-bil.jpg" alt="New Honda Cars SUVs Vans" name="Image30" width="96" height="30" border="0" hspace="3" vspace="4"></a></td>
                    </tr>
                    <tr>
                    	<td align="center" valign="middle"><a href="used-cars/pre-owned-vehicle.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image31','','images/used-cars-bil-d.jpg',1)"><img src="images/used-cars-bil.jpg" alt="Used Cars Honda Pre-Owned vehicles" name="Image31" width="96" height="30" border="0" hspace="3" vspace="4"></a></td>
                    </tr>
                    <tr>
                    	<td align="center" valign="middle"><a href="vehicle-financing/vehicle-financing.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image32','','images/car-credit-bil-d.jpg',1)"><img src="images/car-credit-bil.jpg" alt="Car Credit Automotive financing" name="Image32" width="96" height="30" border="0" hspace="3" vspace="4"></a></td>
                    </tr>
                    <tr>
                    	<td align="center" valign="middle"><a href="Honda-Service/honda-service.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image33','','images/Honda-Service-bil-d.jpg',1)"><img src="images/Honda-Service-bil.jpg" alt="Honda Car Service" name="Image33" width="96" height="30" border="0" hspace="3" vspace="4"></a></td>
                    </tr>
                    <tr>
                    	<td align="center" valign="middle"><a href="Honda-Parts/honda-parts.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image34','','images/Honda-Parts-bil-d.jpg',1)"><img src="images/Honda-Parts-bil.jpg" alt="Honda Parts and Accessories" name="Image34" width="96" height="30" border="0" hspace="3" vspace="4"></a></td>
                    </tr>
                </table>
                </td>
              </tr>
            </table>
              </noscript>
              <!-- end flash billboard -->
        </td>
        <td align="center" style="width:250px"><a href="2009-Honda-Vehicles/no-dealer-handling.php"><img src="images/one-true-price.jpg" style="padding-bottom:5px" alt="One ture price. Your best price." border="0"></a><!--<a href="2009-Honda-Vehicles/honda-green.php"><img src="images/go_honda_go_green.jpg" style="padding-bottom:5px" alt="Go Green, Go Honda" border="0"></a> --></td>
      </tr>
      <tr>
        <td style="background-image: url(images/ask_patty_certified.jpg); background-repeat:no-repeat; background-position:center; width:229px; height:72px; padding-top:9px; background-position:top; width:250px" valign="top" ><p style="color:#666666; font-size:13px; text-align:left; padding-left:69px;"> We pay top dollar<br>
          for used cars!<br>
          <a href="vehicle-financing/value-your-trade.php" class="map">Click Here >></a></p></td>
      </tr>
      <tr>
        <td colspan="2" valign="top" style="height:58px" align="center">
      <!-- Start Vehicle chicklets -->
      <div align="center" id="chicklet_layer" style=" position:absolute; width:100%; height:285;left:0px;top:107px; visibility:visible">
          <script language="JavaScript" type="text/javascript">
<!--
if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
	alert("This page requires AC_RunActiveContent.js.");
} else {
	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightVersion) {  // if we've detected an acceptable version
		// embed the flash movie
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
			'width', '861',
			'height', '285',
			'src', 'home_nav',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'home_nav',
			'bgcolor', '#ffffff',
			'name', 'home_nav',
			'menu', 'true',
			'allowScriptAccess','sameDomain',
			'allowFullScreen','false',
			'movie', 'home_nav',
			'salign', ''
			); //end AC code
	} else {  // flash is too old or we can't detect the plugin
		var alternateContent = '<table cellpadding="0" cellspacing="0"><tr><td><a href="2009-Honda-Vehicles/colorado-accord.php" title="Honda Accord"><img src="images/Accord-Honda.jpg" alt="Accord Inventory" border="0"></a></td><td><a href="2009-Honda-Vehicles/colorado-civic.php" title="Honda Civic"><img src="images/Civic-Honda.jpg" alt="Civic Inventory" border="0"></a></td><td><a href="2009-Honda-Vehicles/colorado-crv.php" title="CRV Honda Inventory"><img src="images/CRV-Honda.jpg" alt="CRV Inventory" border="0"></a></td><td><a href="2009-Honda-Vehicles/colorado-element.php" title="Element SUV Inventory"><img src="images/Element-Honda.jpg" alt="Element Colorado Inventory" border="0"></a></td><td><a href="2009-Honda-Vehicles/colorado-fit.php" title="Fit Vehicle Inventory"><img src="images/Fit-Honda.jpg" alt="Fit Centennial Inventory" border="0"></a></td><td><a href="2009-Honda-Vehicles/colorado-odyssey.php" title="Odyssey van"><img src="images/Odyssey-Honda.jpg" alt="Odyssey Van Inventory" border="0"></a></td><td><a href="2009-Honda-Vehicles/colorado-pilot.php" title="Honda Pilot SUV"><img src="images/Pilot-Honda.jpg" alt="Pilot SUV Inventory" border="0"></a></td><td><a href="2009-Honda-Vehicles/colorado-ridgeline.php" title="Honda Ridgeline"><img src="images/Ridgeline-Honda.jpg" alt="Ridgeline Truck Inventory" border="0"></a></td><td><a href="Honda-Vehicles-2010/colorado-insight.php" title="Honda Insight"><img src="images/Insight-Honda.jpg" alt="Insight Inventory" border="0"></a></td></tr></table>';
		document.write(alternateContent);  // insert non-flash content
	}
}
// -->
</script>
          <noscript>
           <table cellpadding="0" cellspacing="0">
        	<tr>
            	<td><a href="2009-Honda-Vehicles/colorado-accord.php" title="Honda Accord"><img src="images/Accord-Honda.jpg" alt="Accord Inventory" border="0"></a></td>
                <td><a href="2009-Honda-Vehicles/colorado-civic.php" title="Honda Civic"><img src="images/Civic-Honda.jpg" alt="Civic Inventory" border="0"></a></td>
                <td><a href="2009-Honda-Vehicles/colorado-crv.php" title="CRV Honda Inventory"><img src="images/CRV-Honda.jpg" alt="CRV Inventory" border="0"></a></td>
                <td><a href="2009-Honda-Vehicles/colorado-element.php" title="Element SUV Inventory"><img src="images/Element-Honda.jpg" alt="Element Colorado Inventory" border="0"></a></td>
                <td><a href="2009-Honda-Vehicles/colorado-fit.php" title="Fit Vehicle Inventory"><img src="images/Fit-Honda.jpg" alt="Fit Centennial Inventory" border="0"></a></td>
                <td><a href="2009-Honda-Vehicles/colorado-odyssey.php" title="Odyssey van"><img src="images/Odyssey-Honda.jpg" alt="Odyssey Van Inventory" border="0"></a></td>
                <td><a href="2009-Honda-Vehicles/colorado-pilot.php" title="Honda Pilot SUV"><img src="images/Pilot-Honda.jpg" alt="Pilot SUV Inventory" border="0"></a></td>
                <td><a href="2009-Honda-Vehicles/colorado-ridgeline.php" title="Honda Ridgeline"><img src="images/Ridgeline-Honda.jpg" alt="Ridgeline Truck Inventory" border="0"></a></td>
                <td><a href="Honda-Vehicles-2010/colorado-insight.php" title="Honda Insight"><img src="images/Insight-Honda.jpg" alt="Insight Inventory" border="0"></a></td>
        	</tr>
        </table>
            </noscript>
            
             <!-- End Vehicle chicklets -->
			</td>
      </tr>

Open in new window

0
Comment
Question by:Cutthroat_Trout
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 34

Accepted Solution

by:
Beverley Portlock earned 500 total points
ID: 24425245
PHP being a server side language has no direct interaction with the Flash Player. Things that do interact with the webserver, like a browser, are detectable, but detecting Flash is usually done via client-side scripts - usually javascript.

Examples of javascript detection for Flash are at

http://www.featureblend.com/javascript-flash-detection-library.html

You can detect the Browser and OS type from $_SERVER['HTTP_USER_AGENT'] but this can be spoofed quite easily. See here

http://apptools.com/phptools/browser/
0
 
LVL 7

Expert Comment

by:tg_wilk
ID: 24425419
PHP is a server-side language. It means, that apart from the information sent by browser in the headers while asking for the page (only when working as apache module), you don't have any information whether flash is present or not. You have to decide on some other means of checking. Like a html page with a redirect to flash version in swf object. If flash is present - it will redirect, if not html version would stay.
0
 

Author Comment

by:Cutthroat_Trout
ID: 24425740
OK so detecting the user's browser is pretty easy and I can write a conditional php statement to handle that part. But my main problem still remains. I need the detection code (not run it twice) and need an more specific example of the detection code using Java Script once and then running both sets of flash or running both sets of HTML.
0
 

Author Closing Comment

by:Cutthroat_Trout
ID: 31583079
Answer was partially what I was looking for.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question