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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:38:09+00:00 2026-05-18T08:38:09+00:00

In Firefox seems fine, Chrome and Internet Explorer the text is still selectable, is

  • 0

In Firefox seems fine, Chrome and Internet Explorer the text is still selectable, is there any way around this? The code was taken from another question, (which I can’t find right now) so it may be out of date?

// Prevent selection
function disableSelection(target) {
    if (typeof target.onselectstart != "undefined") // Internet Explorer route
        target.onselectstart = function() { return false }
    else if (typeof target.style.MozUserSelect != "undefined") // Firefox route
        target.style.MozUserSelect = "none"
    else // All other routes (for example, Opera)
        target.onmousedown = function() { return false }
}

Used in code as:

disableSelection(document.getElementById("gBar"));
  • 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-18T08:38:10+00:00Added an answer on May 18, 2026 at 8:38 am

    For webkit use khtmlUserSelect instead of MozUserSelect .

    In opera and MSIE you may set the unselectable-property to “On”

    As the both styles related to gecko/webkit are CSS, you can use a class to apply it:

    <script type="text/javascript">
    <!--
    function disableSelection(target)
    {
      target.className='unselectable';
      target.setAttribute('unselectable','on');
    }
    //-->
    </script>
    <style type="text/css">
    <!--
    .unselectable{
    -moz-user-select:none;
    -khtml-user-select: none;
    }
    -->
    </style>
    

    Note: unselectable will not pass on child-elements, so if you have there anything else than textNodes inside target, you need the workaround you already have there for MSIE/opera.

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

Sidebar

Related Questions

I can't seem to get it to work. It works fine in Firefox, but
In Firefox a Reload seems to reload everything while on IE the Refresh reloads
It seems that HTML 5 is going to be supported (partially) by Firefox 3.1
I always seem to have a hard time starting a new Firefox extension. Can
Firefox 3 has introduced a new behavior in which line-height, when unset, differs from
What Firefox add-ons do you use that are useful for programmers?
In Firefox you can enter the following into the awesome bar and hit enter:
In Firefox and Safari, pages that are centered move a few pixels when the
In Firefox...... <div id=container style=overflow:scroll; width:400px; height:500px> <div id=content style=height:500px; width:800px/> </div> The container
In Firefox when you add an onclick event handler to a method an event

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.