Rebecca Joy Sherman wrote:
> Does anyone know some simple code for
> browser,flash,activex,windows media,
> and real player detection? Please help!
You can do this with a combination of CF and JavaScript code or you can go
with a third party utility like BrowserHawk (www.browserhawk.com). If you
want to go with the CF and JS method, you can check the CGI.HTTP_USER_AGENT
variable to help determine which browser is being used. For example, here
are the values for that variable for some of the browsers on my system:
IE6 = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
NS6 = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:0.9.4)
Gecko/20011128 Netscape6/6.2.1
NS4.7 = Mozilla/4.79 [en] (Windows NT 5.0; U)
Mozilla = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0)
Gecko/20020530
There is also a JavaScript method for determining the browser. See
http://www.webreference.com/tools/browser/javascript.html.
To check which file formats are supported, you can use JS code like the
following:
<SCRIPT LANGUAGE="JavaScript">
<!--
var pdf_flag = 0;
var fdf_flag = 0;
for (i = 0; i < navigator.mimeTypes.length; i++)
{
if (navigator.mimeTypes[i].type == "application/pdf")
{
pdf_flag = 1;
}
if (navigator.mimeTypes[i].type == "application/vnd.fdf")
{
fdf_flag = 1;
}
}
// -->
</SCRIPT>
<PRE>
MIME TYPE SUFFIXES DESCRIPTION
============ ======== ================
application/vnd.fdf fdf AcroEx32 File
application/pdf pdf Acrobat
</PRE>
<SCRIPT LANGUAGE="JavaScript">
<!--
if (pdf_flag == 1)
{
document.write("You have PDF<P>");
}
if (fdf_flag == 1)
{
document.write("You have FDF");
}
// -->
</SCRIPT>
Just modify it to fit your needs (this code was some test code I wrote a
ways back to check for PDF/FDF support).
--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 625-9191
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com