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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:22:56+00:00 2026-06-19T04:22:56+00:00

I am building an application using PhoneGap for Android that can also be uploaded

  • 0

I am building an application using PhoneGap for Android that can also be uploaded to a server and used as a website.

The problem I’m having is that on the login page I have a JSON call to a php page to check the login credentials and this only works if the user has typed in the full url Including the http://www., otherwise it returns a json cross-domain error.

I solved this problem using the code below which adds the ‘www.’ if its not found.

if (document.URL.toLowerCase().indexOf("www.") == -1) {
        var new_url = document.URL.slice(0, 7) + "www." + document.URL.slice(7);
        window.location = new_url;
}

I need to check to see if the user is using the application as a website and call the code above, or if they are using it as an Android app, skip the code above. At the moment the Android app tries to redirect when it hits this code, giving a network error.

Any help is appreciated, Thanks.

  • 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-19T04:22:58+00:00Added an answer on June 19, 2026 at 4:22 am

    You can do this using navigator object like this:

    Wrap your above code inside the if() block,

    var ua = navigator.userAgent;
    if(!(ua.match(/Android/i))){
       //this code will run only when there is any non-android client.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Helo. I am building an application for kids using Phonegap. On Android I have
i am building a server application using eclipse , and the client is android
I'm building an application for Android using Phonegap & jQuery Mobile. I want to
I am building a Sencha Touch application that I then build using PhoneGap. When
I'm building my application using PhoneGap Build and all builds are ok with the
I'm building an application for iPhone(iOS 5) using Phonegap(Html + Javascript + Css), and
I'm building an android app which supports push notifications using phonegap/cordova and this plugin
I am building an application using the Play! framework version 2.0.4. Some pages that
I am building an application using OpenCV that uses the webcam and runs some
I'm building a hybrid mobile application (PhoneGap+JQM). While testing in the Android emulator, I'm

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.