Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8147633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:24:51+00:00 2026-06-06T14:24:51+00:00

I want to divide my styles and scripts according to user-agent(mobile , ie ,

  • 0

I want to divide my styles and scripts according to user-agent(mobile , ie , chrome-ff).How can control and allow include or not ?

maybe for ie i can use < !–[if IE] > , but how about others ?
Somebody advice me plz , thx

 <head runat="server" id="head">
    <%--Only mobile--%>
      <link href="Styles/CommonMobile.css" rel="stylesheet" type="text/css"/>
      <link href="Styles/SiteMobile.css" rel="stylesheet" type="text/css"/>
      <script src="Scripts/CommonMobile.js" type="text/javascript"></script>
      <script src="Scripts/SiteMobile.js" type="text/javascript"></script>

    <%--All but IE --%>
      <link href="Styles/GeneralView.css" rel="stylesheet" type="text/css" />
      <script src="Scripts/GeneralView.js" type="text/javascript"></script>

    <%--Only IE --%>
      <link href="Styles/IE.css" rel="stylesheet" type="text/css" />
      <script src="Scripts/IE.js" type="text/javascript"></script>


   <%--Always--%>
      <link href="Styles/Common.css" rel="stylesheet" type="text/css" />
      <script src="Scripts/Common.js" type="text/javascript"></script>
</head>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:24:52+00:00Added an answer on June 6, 2026 at 2:24 pm

    A nice way is to warp them with a Literal and open it or not on code behind. I say Literal because is one of the few controls that can run inside the header and leave no extra code.

    So I do it that way

     <asp:Literal runat="server" ID="OnlyIE" EnableViewState="false" Visible="false">
           <link href="Styles/IE.css" rel="stylesheet" type="text/css" />
          <script src="Scripts/IE.js" type="text/javascript"></script>
     </asp:Literal>
    

    and

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Browser.Browser == "IE")
        {
            OnlyIE.Visible = true;
        }
    }
    

    [*] tested and working.

    A Different way is again to use the Request.Browser.Browser and fully render the css and javascript again inside a Literal, or even harder to create the controls using the Controls.Add, but all of that is much more code than this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to divide the window into 2 parts. Each part I can draw
I want to divide size of a control with a size of a form
What math can you use in this following example: I want to divide a
I want to divide a menu such that I can have different items of
I want to divide a number of type double, by an int. I only
I want to divide my window (wpf) in three columns: left column must be
Here's a contrived example: I want to divide two numbers and I need to
I have 2 Ids #totalcbm and #gross , i want to divide both these
i m the beginner in iphone. I want the divide the circle in equal
I'm just a beginner with android. I want to divide a bitmap image into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.