Is it possible to suppress the default IE 7 functionality when CTRL+click on link opens a new window? if so, how?
Thanks!
Is it possible to suppress the default IE 7 functionality when CTRL+click on link opens a new window? if so, how?
Thanks!
The jQuery event.preventDefault() method or similar can override default behavior on pages that you have control over.
It is generally bad practice to alter the behaviour of a user's browser without really good reason as the browser and its behaviour is "their's".
Add script to the anchor and return false
<a href='some.htm' onclick='return false;'></a>
And it is valid to use anchors in a treeview because it makes the treeview more accessible.
There is no way to suppress a Ctrl+Click on a link in Internet Explorer -- the onclick
event doesn't fire at all for link clicks if the Ctrl key is held down. It seems that Microsoft don't want you to change this functionality out of fear that you might confuse the user :-)
I searched for some sort of official confirmation/explanation before posting this answer, but unfortunately this limitation is not listed in the documentation on MSDN and Google wasn't helpful. Never-the-less, it remains true, try it yourself:
<a href="http://stackoverflow.com" onclick="alert('Hello');">Hello</a>
You will find that a Ctrl + click on the link will not throw the alert box.