pointer-events: none does not work in IE9 and IE10
From the MDN docs:
Warning: The use of pointer-events in CSS for non-SVG elements is experimental. The feature used to be part of the CSS3 UI draft specification but, due to many open issues, has been postponed to CSS4.
Read more here, basically, pointer-events
on a non-SVG (Scalable Vector Graphic) is non-standard.
If you check the browser support table on the linked page (about two-thirds down) you'll note that IE support on non-svg's is ziltsh, jack squat, naut,... not supported, that is.
After some digging, I did come across this article that does allow for you to mimic the behaviours through use of layers, and , thanks to this post, I found this JS-bin That might help...
However, in IE (and Opera, and AFAIK all browsers), you could simply force a type of cursor on an element:
a, a:hover, a:visited, a:active, a:focus /*, * <-- add all tags?*/
{
cursor: default;/*plain arrow*/
text-decoration: none;/*No underline or something*/
color: #07C;/*Default link colour*/
}
The result should be pretty similar to that of pointer-events: none;
Update:
If you want to prevent the click events in IE that, as shasi pointed out, is prevented in other browsers, simply add an event listener that delegates the click event.
I'll assume, at the moment, that you're targeting all a
elements:
var handler = function(e)
{
e = e || window.event;
var target = e.target || e.srcElement;
if (target.tagName.toLowerCase() === 'a')
{
if (!e.preventDefault)
{//IE quirks
e.returnValue = false;
e.cancelBubble = true;
}
e.preventDefault();
e.stopPropagation();
}
};
if (window.addEventListener)
window.addEventListener('click', handler, false);
else
window.attachEvent('onclick', handler);
That should prevent all click events on anchor elements.
IE10: pointer-events: none still trigger the element
Instead of using a polifyll you can use a simple jQuery to support IE,
see snippet below:
$(document).on('mousedown', '.pointed', function(e) { $(this).hide(); var PointerElement = document.elementFromPoint(e.clientX, e.clientY); $(this).show(); $(PointerElement).mousedown(); //Manually fire the event for desired underlying element return false;});
.pointed { pointer-events: none /*for every non-IE browser*/}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><div class="pointed">ClickME!</div>
css 'pointer-events' property alternative for IE
Pointer-events is a Mozilla hack and where it has been implemented in Webkit browsers, you can't expect to see it in IE browsers for another million years.
There is however a solution I found:
Forwarding Mouse Events Through Layers
This uses a plugin that uses some not well known/understood properties of Javascript to take the mouse event and send it to another element.
There is also another Javascript solution here.
Update for October 2013: apparently it's coming to IE in v11. Source. Thanks Tim.
Pointer events: none, filter, works in ie8 and anywhere, not ie9
You're right - AlphaImageLoader filter has been removed from IE9. This was done so that it doesn't conflict with the standards compliant methods. In this case, pointer-events: none
, which now works in IE9.
If you're using a conditional comments to target IE for the filter fix, change them to target only IE8 and below. Try changing <!--[if IE]>
to <!--[if lte IE 8]>
Edit: I've since come across this again and it appears that pointer-events: none
does not work in IE9 (not for HTML elements anyway). I thought this was working, but on re-testing neither method works for click-through on IE9. Perhaps I had my IE9 in a compatibility mode.
It's not ideal at all, but you could force IE9 into IE8 mode via the <meta>
tag switch:
<!--[if ie 9]><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"><![endif]-->
Apologies for the misinformation, I'll keep looking into this.
Update Sept 24 2012:
The wonderfully useful caniuse.com has more information on pointer-events
for HTML. Support in IE10 is still unknown and it appears that Opera does not support this property either. I would advise against using pointer-events
for now unless you're specifically targeting Webkit/Mozilla.
Related Topics
Difference Between the 'Controller', 'Link' and 'Compile' Functions When Defining a Directive
How to Set a JavaScript Breakpoint from Code in Chrome
Correct Use of Arrow Functions in React
Create Array of Unique Objects by Property
How to Concatenate Properties from Multiple JavaScript Objects
Does JavaScript Support 64-Bit Integers
Detecting Back Button/Hash Change in Url
How to Define Custom Sort Function in JavaScript
How to Pass a JavaScript Variable to Another Browser Window
Method Overloading in JavaScript
Get Caret (Cursor) Position in Contenteditable Area Containing HTML Content
Settimeout Ignores Timeout? (Fires Immediately)
Use Dynamic (Variable) String as Regex Pattern in JavaScript