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

  • SEARCH
  • Home
  • 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 6857743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:03:58+00:00 2026-05-27T02:03:58+00:00

I have an application that has a good look on screens, but has a

  • 0

I have an application that has a good look on screens, but has a rigid framework that makes difficult to use it in mobiles and similar.. So I’ve made an specific CSS file to fit these devices. That’s ok, I use a main.css that defines general looking (for all media) and a handheld.css file that makes corrections for this kind of devices:

<link rel="stylesheet" media="all" type="text/css" href="main.css" />
<link rel="stylesheet" media="handheld,tv" type="text/css" href="handheld.css" />

The problem is that some devices like an iPad have a great looking with the general screen version and don’t need to downgrade like in some mobiles. So I have put in my app a link that sets a cookie that forces to display like in a desktop screen. The problem is I don’t know how to force to not load handheld.css. Javascript may be? But, how?

  • 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-05-27T02:03:59+00:00Added an answer on May 27, 2026 at 2:03 am

    I think what you’re looking for is media queries. This won’t solve your question, but it is how you should go about solving the bigger problem (layout responding to different screen sizes) in the future.
    Example: http://www.barackobama.com/ (resize the width of page to see what it does)

    Learn how:

    http://coding.smashingmagazine.com/2010/07/19/how-to-use-css3-media-queries-to-create-a-mobile-version-of-your-website/
    http://www.vanseodesign.com/css/media-queries/
    http://www.adobe.com/devnet/dreamweaver/articles/introducing-media-queries.html
    http://designmodo.com/media-queries/

    To solve your specific problem, read below:
    working example of website with css stylesheet switching:
    http://jsfiddle.net/y6FWK/2/

    This is something new to me… Wasn’t expecting it to work so easily, but, since the <link> is just another dom element, you can just refer to it (easiest to give it an id) and simply change it’s href value… I was surprised.

    <link rel="stylesheet" type="text/css" href="" id="cssSwitch" />
    

    Then some buttons to change the css… or whatever you’d like

    <input type="button" id="enableMobile" value="mobile css" />
    <input type="button" id="enableMain" value="main.css" />
    

    Then, within your code:

    $("#enableMobile").on("click", function(){
        $("#cssSwitch").attr("href", "handheld.css");
    });
    
    $("#enableMain").on("click", function(){
        $("#cssSwitch").attr("href", "main.css");
    });
    

    To my surprise, it actually worked.

    Tested and worked in

    • IE (8)
    • Chrome (15)
    • FireFox
    • Android Samsung Galaxy S (default browser)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that has 2 beans with the same name, but which
I have a .NET 2.0 application that runs on Compact Framework. It has a
We have an application that has a database full of polygons (currently stored as
I have a application that has an activity that shows message logs. The thing
I have an application that has two localization options at the moment through .resx
I have an application that has two threads. The first one (the main thread)
i have an application that has a dependancy on gdiplus. i need the application
I have an application that has a list of buttons and has customized tooltips.
I have an application that has a .sql file in it. The sql file
We have an application that has a WCF service (*.svc) running on IIS7 and

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.