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

  • Home
  • SEARCH
  • 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
  • 1 View
  • 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 have a simple Ajax script that works perfectly fine in Chrome, Internet Explorer
Can't seem to get my font working in firefox, seems to work fine in
I can't figure this one out. It seems to work in IE8+ and Firefox,
This would seem to be the case in Firefox 3.5+, there I can instantiate
There seems to be a bug in firefox where if I put anything on
I have a jQuery script that works perfectly fine in Chrome 11 and Firefox
This seems like a common issue but I have not found any questions that
Currently the page I am working displays fine in Chrome and Firefox, but in
I am having issues getting some jquery to work on internet explorer...sometimes it seems
My background-image transition is working fine in Chrome, but does nothing in Firefox. I

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.