Solved

Detecting Flash Player and version as well as browser

Posted on 2009-05-19
4
678 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
  • 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The viewer will learn how to dynamically set the form action using jQuery.

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now