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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:27:39+00:00 2026-06-09T07:27:39+00:00

Is it possible to disable text selection to make a PhoneGap app more similar

  • 0

Is it possible to disable text selection to make a PhoneGap app more similar to normal native app?

Something like this:

document.onselectstart = function() {return false;}

or:

* { 
user-select: none;
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
}

Or many other things don’t work.

  • 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-09T07:27:41+00:00Added an answer on June 9, 2026 at 7:27 am

    I looked all over for help on this. This finally worked for me.

    public class MainActivity extends DroidGap {
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            super.loadUrl("file:///android_asset/www/index.html");
    
            super.appView.setOnLongClickListener(new View.OnLongClickListener() {
    
                public boolean onLongClick(View v) {
                    return true;
                }
            });
        }
    }
    

    The setOnClickListener is what does the magic. Make sure you put this AFTER your call to super.loadUrl.

    Of course, this will disable text selection for your entire app, but I’m OK with that, and I don’t have any other way around it for now.

    I’m not sure of the complete implications of this yet, but I do make use of the JqueryMobile event “taphold”, and it still works fine. I believe this works by handling the long click on the appView (which hosts your HTML app) and preventing it from bubbling up.

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

Sidebar

Related Questions

Possible Duplicate: css rule to disable text selection highlighting On my homepage i have
Is it possible to disable the OData support? I dont want this automatism because
Is it possible to selectively disable the autofill feature in text fields using code?
I don't want to repeat alt text in title again? is this possible with
How is it possible to DISPLAY text with simple formatting (like font color) in
Is it possible to make the text in a TextBox unselectable without disabling the
Is it possible for a disabled <input> tag to support text selection?
Is it possible to disable support for camel case in the Eclipse text editor?
I hate bold text while coding. Is it possible to disable bold text (and
Is it possible to disable decoding xml text content when parsing an xml file

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.