Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[FMX] Flash detection Script and PHP

Status
Not open for further replies.

splitrockresort

Programmer
Jun 3, 2004
4
US
This is my problem...

I'm creating a site in php which pulls in the header seperately with an include ( <? include("header.php") ?> ).

The header uses flash but I've also created a dhtml version the emulates some of the flash features for those without flash....

What I'm looking for is a flash 6 detection script that will
1. test to see if the user has flash
2. if he has flash it will excute the flash movie
3. if he doesn't have flash, it will execute the dhtml code

I need all of this to work on one page (header.php)


I've seen scripts that will display a flash image if you have flash and a jpeg or gif if you don't...

but I haven't seen any that will execute html code (without transfering you to another page) instead of simply displaying a static image....


does any one have a script that operates like this?


i'm using this script:



<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words)))
continue;
var MM_PluginVersion = words;
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( MM_FlashCanPlay ) {
window.location.replace("header.php");
} else{
window.location.replace("header2.php");
}
//-->

</SCRIPT>


and i'm trying to modify it like this:



window.location.replace("<? include("header.php") ?>");
} else{
window.location.replace("<? include("header2.php") ?>");


but it wind's up showing BOTH headers and some of the javascript script code.....
(see )

I know it's the quotaion marks or maybe the question marks php uses....
any idea on how to go around this...?
 
location.replace is looking for a webpage which is not what you're supplying as a parameter.

You can try writing the page code dynamically via javascript instead:

document.write("<? include("header.php") ?>");
} else{
document.write("<? include("header2.php") ?>");
 
By looking at that url...
I figured out that what's screwing up the javascript is the parentheses...
You can't see to have have two sets is the javascript....

Anyone know a way around this,,,,

 
Not sure, but think it's more the double double quotes...
Try...

document.write("<? include('header.php') ?>");
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top