Suppressing the thick selection-border in Netscape and FireFox

Posted on 2005-04-29
Last Modified: 2008-02-01
Hi, all!

I have the next problem in Netscape and FireFox browsers. When user clicks by left mouse button over some tags (<object>, <td>...) with pressed CONTROL-key, thick  border appears around. My HTML-page uses left mouse button click with pressed CONTROL and such behavior of Netscape is confuses user.

Who know, how can i turn off this border?  Atleast, for <table>, <tr>, <td> and <object> tags.

Also, i want to make all page elements nonselectable. User should not be able to select text and other elements by mouse. Normal behaviour should be kept only for <input> and <textarea>.

How to cancel selection in Netscape and FireFox browsers? I had cancelled selection and context menu in Internet Explorer, but not in Netscape and FireFox.

In Microsoft Internet Explorer i had done it as:

var isIEBrowser = navigator.appName.indexOf( "Microsoft" ) != -1;

        var b = document.getElementById( "idBody" );
      if( b )
            b.oncontextmenu = cancelContextMenu;
            if( isIEBrowser )
                  b.onselectstart = cancelSelect;

function cancelContextMenu( e )
      var ev = new InterEvent( e );
      var name = ev.srcEl.tagName.toLowerCase();
      return name == "input" || name == "textarea";
function cancelSelect()
       var ev = window.event;

      var name = ev.srcEl.tagName.toLowerCase();
      if( name != "input" && name != "textarea" )
                ev.returnValue = false;
                ev.cancelBubble = true;
            return false;
            return true;

Question by:alexf2
    LVL 30

    Expert Comment

    Why would you want to change normal browser behaviour?
    The ctrl+click is a great feature in firefox, i use it very often.
    If you want to protect your text from being copied, then put it inside a PNG or GIF image, that's the only way.

    Author Comment

    A thick rectangle appearing around <td> or <object> is confuse user. In my application <object>/<embed> tags are representing "Macromedia Flash Player" placed inside <td>. I had implemented a drawings viewer based on "Flash Player" which functionality includes ZoomIn, ZoomOut, Pan and some other functions. And, a thick frame caused by "ctrl+left click" is an unexpected and hindering decoration.

    It is uncorrelated with design and  functionality.

    The ability to select HTML-elements (text, buttons...) in some cases is stiring to "Pan" and to "Zoom by Window" drawings by mouse. Dark blue selection appears as unpredictable and covers "Flash Player" and neighbouring HTML-elements. Looks awfully. In "Internet Explorer" it is already suppressed by me and works fine, but in Netscape and FireFox is not.

    I had programmed for "Internet Explorer", but in Netscape and FireFox - i am beginner.  Who can assist to suppress "thick rectangle" caused by "ctrl+left click" and ability to select elements?
    LVL 30

    Expert Comment

    Ok, it makes much more sense now with these additional comments.
    It seems to be a bug in the flash plugin, i just did the same thing over a java applet, and the ctrl+click is not passed to the browser.
    You can send a bug report to Macromedia (or should i say to Adobe...)

    Author Comment

    Hi, GrandSchtroumpf!

    No. It is not a bug. Open "" in Netscape or FireFox, press and hold CONTROL key and try to click "left mouse button" over the HTML-page. You will see, in some places around <table>, <td> tags dark blue thick borders.

    Also, i want to notice. Mouse click will be passed to browser if you left-click  over "Flash Player" only in case if "Flash Player" is activated as "Windowless" and "Transparent". In order to reach this, you
    <PARAM NAME="WMode" VALUE="transparent">  should insert inside <object> tag.

    <OBJECT  id="idFla"  style="border-style: none; " codeBase=",0,0,0"
     height="450" width="100%" align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  VIEWASTEXT  >
         <PARAM NAME="FlashVars" VALUE="">
         <PARAM NAME="Movie" VALUE="FlashLoader.ashx?swfid=<%#SwfURL%>">
         <PARAM NAME="WMode" VALUE="transparent">
          <PARAM NAME="Play" VALUE="false">
          <PARAM NAME="Loop" VALUE="false">
          <PARAM NAME="Quality" VALUE="High">
          <PARAM NAME="SAlign" VALUE="LT">
          <PARAM NAME="Scale" VALUE="noscale">
          <PARAM NAME="Menu" VALUE="false">
          <PARAM NAME="Base" VALUE="">
          <PARAM NAME="AllowScriptAccess" VALUE="sameDomain">                                                                  
          <PARAM NAME="DeviceFont" VALUE="0">
          <PARAM NAME="EmbedMovie" VALUE="0">
          <PARAM NAME="BGColor" VALUE="FFFFFF">
          <PARAM NAME="SWRemote" VALUE="">
          <PARAM NAME="MovieData" VALUE="">
          <PARAM NAME="SeamlessTabbing" VALUE="1">                                                                                    
          <param name = "SWLIVECONNECT" value = "true" >                                                                                    
          <embed id="idFlaEmb"  name="idFla" Scale = "noscale" src="FlashLoader.ashx?swfid=<%#SwfURL%>" quality="high" bgcolor="#ffffff" height="450" width="100%"  allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage=""  SWLIVECONNECT = "true" MENU="false" WMode = "transparent" SAlign="LT" />
    LVL 30

    Accepted Solution

    > You will see, in some places around <table>, <td> tags dark blue thick borders.
    I know the border is not a bug, it's a firefox selection feature.  It allows you to select an entire cell.  If you do ctrl+c when that thick border shows, then it copies the content of the cell to the clipboard.  It's very nice to copy/paste code posted to this forum for example.
    Note that it only works on table cells, so moving your layout from table-based to css-only will solve the problem.

    > Mouse click will be passed to browser if you left-click  over "Flash Player" only in case if "Flash Player" is activated as "Windowless" and "Transparent".
    I don't know much about flash... but why don't you set your flash properties to something else than "Windowless" and "Transparent"?  Then you should not get the cell selection.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    After uninstalling Opera browser (for example ver. 10.63), your attempts to open a web page by clicking on a URL link may fail with an error message.  The error is "This operation has been canceled due to restrictions in effect on this computer. Ple…
    Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
    Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
    How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now