Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 357
keshav84 Avatar asked Aug 19 '10 07:08

keshav84


2 Answers

Unfortunately, there is no cross-version solution. In IE9 there is opportunity, allowing to disable automatic hyperlinking:

document.execCommand("AutoUrlDetect", false, false);

More information: http://msdn.microsoft.com, http://bytes.com

like image 105
Maxon Avatar answered Nov 03 '22 14:11

Maxon


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.

like image 40
Tim Down Avatar answered Nov 03 '22 15:11

Tim Down