hello friends...
i want to get the browser name is asp code without using js and include the css file depending upon the browser of the user.
i dont want to use js. because i am unable to include file in js.
what i did in js is ---

        var browser=navigator.appName;
        var b_version=navigator.appVersion;
        var version=parseFloat(b_version);
        if(navigator.appName =="Netscape")
        {
                //document.write("Mozila or Safari")
            // want to include css              
        }
        else
        {
            //document.write("IE")
                // want to include css 
        }

please help.

Recommended Answers

All 3 Replies

request.servervariables("HTTP_USER_AGENT")

this detects the current browser. Not version.

hi
what i did is....

dim UserAgent

UserAgent = Request.ServerVariables("HTTP_USER_AGENT")
Response.Write "<p>" & UserAgent & "</p>"

if instr(1,UserAgent,"MSIE") > 0 then
Response.Write "Browser is Internet Explorer"
%>
<html><head><style type="text/css">
@import url("Home_index_IE.css");
</style></head></html>
<%
else
%>
<html><head><style type="text/css">
@import url("Home_index_NetScape.css");
</style></head></html>
<%
Response.Write "Browser is not Internet Explorer"
end if
%>

well did it work?

If not, test what HTTP_USER_AGENT puts out and bind MSIE to that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.