ColdFusion Tutorial

CSS and browser type - Capture visitors browser

There are many JavaSript doing the same. But the spiders don?t like too much JavaScript, it isn?t good food for them. And the user can also see the code. So why not hide this into cfml? And that?s what we do in this little but very useful tutorial.
 
Using the CGI.HTTP_USER_AGENT will capture the browser type of the visitor.
 
For the visitor it isn?t interesting to tell him/her what browser being used, but we can use this information in the code of the page.
 
Here?s an example starting different CSS (Cascading Style Sheets), depending of the visitors browsers.
 
In this example we use the tag ListContainsNoCase. The ListContainsNoCase search the string with case insensitive.
 

<!--- MSIE --->

<cfif ListContainsNoCase(#cgi.http_user_agent#,"MSIE")>

Open Style Sheet for MSIE

<!--- Opera --->

<cfelseif ListContainsNoCase(#cgi.http_user_agent#,"OPERA")>

Open Style Sheet for OPERA

<!--- Firefox --->

<cfelseif ListContainsNoCase(#cgi.http_user_agent#,"Firefox")>

Open Style Sheet for Firefox

<cfelse>

Open default Style Sheet

</cfif>

ColdFusion Tutorial test

CSS and browser type - Capture visitors browser

No test is available or implemented for this ColdFusion Tutorial.

No User Comments.

No User Comments, be the first one to write your comments?

Add your comments

Your Name*:
Your Email:
Site URL:
Site Name:
Comemt Title*:
Your Comment*:
Key Phrase*:
zP7
Your IP Address: 38.103.63.62
 

ScandicWeb is own by Scandic Systems LTD [UK] Company No. 5984000. All other trademarks and copyrights are the property of their respective holders.

[Home [Site Map [Privacy Statement [Site Feedback] [About ScandicWeb]


[ColdFusion [Flash [Search Engine Optimization [Graphics [Cascading Style Sheets (CSS) [JavaScript (JS) [Software]

Partner sites: ScandicSoft


Server time: 19. November 2008 Wednesday