/    Sign up×
Community /Pin to ProfileBookmark

determining browser plugins

Ok,
I want to make a page that has a flash (.swf) navigation menu. I know some browsers out there don’t have the flash plugin to view the file on a page, so I also want to have an alternative menu. So it’ll be something like this:

[code=php]
if (some condition) {
/* put the object tags to display the flash file */
}
else {
/* display non-flash menu */
}
[/code]

My problem is, I don’t know what to check to know if the user’s browser can handle flash. Any insights will be helpful

Jaelan

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@96turnerriDec 06.2004 — i should really ask you to post this in JS forum or a mod to move it for you, but im feeling helpful ?, ok well PHP is server side therefore has no communication to the users comp, so it cannot be achieved via PHP

this is untested and use JavaScript (a client side technology)
[code=php]
<script type="text/javascript">
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[i])))
continue;
var MM_PluginVersion = words[i];
}
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) {
document.write('//PUT YOUR FLASH/SWF HTML SOURCE HERE');
} else {
document.write('Sorry, but you need the flash plugin to view this');
}
</script>
[/code]
Copy linkTweet thisAlerts:
@JaelanauthorDec 06.2004 — *slaps forhead* Didn't even think of that...you see? I=noob ? Thanks for the help, and I'll try out your suggestion and see if it works

Thanks,

Jaelan
Copy linkTweet thisAlerts:
@96turnerriDec 06.2004 — ? let me know
Copy linkTweet thisAlerts:
@JaelanauthorDec 06.2004 — Besides my issues loading the function from an external .js file, it worked like a charm. Now it all works, thanks for your help

Jaelan
Copy linkTweet thisAlerts:
@96turnerriDec 06.2004 — glad to have helped
×

Success!

Help @Jaelan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...