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 7444437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:30:51+00:00 2026-05-29T11:30:51+00:00

I have a page called android.html with a button with an id of detect.

  • 0

I have a page called android.html with a button with an id of “detect”. When you click the button, a script checks to see what OS version you have on your android device by the us header. How would I change the script to apply a style if it is version 3.0 or higher and another style if it is version 2.9 and lower. Here is the hard part…I dont want to apply the css style to the android.html page, but to the playlist.html page that you will redirected to on the click of the button.

html

<div id="detect">button</div>

js

$('#detect').click(function() {
if (/Android (\d+(?:\.\d+)+)/.test(navigator.userAgent)){ 
 var version=new Number(RegExp.$1) 
 if (version>=3)
  //redirect to playlist.html using style1.css
 }
else
 //redirect to playlist.html using style2.css
});
  • 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-29T11:30:53+00:00Added an answer on May 29, 2026 at 11:30 am

    Either append a query-string key/value pair to the redirect that lets the next page know which style-sheet to load, or just check the user-agent string when the next page loads.

    $('#detect').click(function() {
        if (/Android (\d+(?:\.\d+)+)/.test(navigator.userAgent)){ 
            var version=new Number(RegExp.$1) 
            if (version>=3)
                window.location = 'playlist.html?style=1';
            } else {
                window.location = 'playlist.html?style=2';
            }
        }
    });
    

    Then on the playlist.html page:

    if (window.locaion.search.indexOf('style=1') > -1) {
        $.getScript('style1.css');
    } else if (window.locaion.search.indexOf('style=2') > -1) {
        $.getScript('style2.css');
    }
    

    This if/then check is pretty simple. A better way to do it would be to get the query-string parameters in an array, check for the style key, then load the corresponding value.

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

Sidebar

Related Questions

In my webapp I have a page called display.php. The script in this page
I have a page called k.html which is in domain A. This page will
I have a page called Error.php. Variables are usually passed to it using the
I have a page called send.email.php which sends an email - pretty simple stuff
I have a page called ..hi i get this error when visiting the page.
I have a page called send.email.php which sends an email - pretty simple stuff
Let's say I have a page called display.php and the user is viewing display.php?page=3
My project is about a school admin I have a page called : createClass.php,
I have a master page called SampleMaster.master and this page contains a Repeater control
I have a page containing a control called PhoneInfo.ascx. PhoneInfo is dynamically created using

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.