Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping auto-hyperlink detection when using "contentEditable"

Status
Not open for further replies.
Dec 8, 2003
17,047
GB
Hi,

I have a problem when using the "contentEditable" feature of IE.

Here's a simple test harness I have built:

Code:
<html>
<body onload="document.getElementById('myDiv').focus();">
	<div contenteditable="true" id="myDiv" style="width:300px; height:100px; border:1px solid #000000; padding:10px;"></div>
</body>
</html>

My problem is this. If you run the above code, and type " into the box, and then type a space (" "), it auto-detects the URL, and underlines and colourises ("colorizes" :eek:) it.

My question is: How can I stop this from happening? I cannot work out how to stop it, or even how to detect it (so I can manually run an "unlink" command).

I'm using IE6 on Win XP Pro, but I think it would happen on IE5.5+.

Thanks in advance!

Dan
 
Here's how you can access the source code through another window:

javascript:void(window.open("javascript:document.open(\"text/plain\");document.write(opener.document.body.parentNode.outerHTML)"))

perhaps you can butcher this to undo the anchor ?? not sure if the security settings will allow this.

just a thought

simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top