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> | |
Advertisement

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