Search code examples
javascripthtmlinternet-explorercontenteditable

Disable Automatic URL detection for Elements with 'contentEditable' flag in IE


When i paste any text in any element with 'contentEditable' flag enabled, IE automatically finds the hyperlinks or email address and replaces them with

<a href="hyperlink">hyperlink</a>.

How can i disable this automatic url detection for elements(e.g. div, span etc.) with 'contentEditable' flag in IE or aleast get the actual text that was pasted in the div.

Best Regards,
Keshav


Solution

  • I don't think you can. You'll need catch the paste event and set a brief timer that calls a function that removes links.

    Edit 30 September 2012

    IE 9 and above has the ability to switch this off. See Maxon's answer.