473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Disable automatic detection of hyperlinks with contentEditable (IE 5.5+)

Hello 'contentEditable' gurus,

The example code below uses contentEditable to let the user edit the
<div> element directly in their browser. Works also using designMode
for the document.

However, if the user edits the <div> by typing:
"jo**@doe.com is listed on the www.yahoo.com webpage"
IE 5.5+ automatically detects the email address and the URL and creates
those 2 hyperlinks automatically.

Is there a way to prevent IE from creating those links automatically?
The same code works fine in Mozilla 1.0+.
Thanks,

Guillaume
<HTML>
<HEAD>
</HEAD>
<BODY>
<DIV ID="oDiv">Type your text here...</DIV>
<SCRIPT>
<!--
oDiv.contentEditable = true;
// -->
</SCRIPT>
</BODY>
</HTML>

Jul 23 '05 #1
2 5786
gb********@gmail.com wrote:
Hello 'contentEditable' gurus,

The example code below uses contentEditable to let the user edit the .... However, if the user edits the <div> by typing:
"jo**@doe.com is listed on the www.yahoo.com webpage"
IE 5.5+ automatically detects the email address and the URL and creates
those 2 hyperlinks automatically.


What a pain in the neck! Just some ideas for you... in case you
implement a solution, please do post it.

If you prefix the email or the web address with a double quote, IE
won't do the nasty. This, of course, is not an acceptable solution.

One possibility is to wait until the div loses the focus, and then do
something like mydiv.innerHTML = protect(mydiv.innerText). Still, the
user would be somewhat confused about what is going on. So, to ratchet
this up, you could do the same type of thing each time the div content
changes (however IE is buggy on this change detection, especially if
the entire element is erased. Example: type jo**@doe.foo, then HOME
(note link), then SHIFT+END, then x, then y, then z. HELLO, IE, anyone
at home?!? Note that xyz is shown as a link even though there is no
cause. Now hit the BACKSPACE. Ah, now IE has woken up again). Or a
variation on this theme would be to replace '@', '.', and ':' with
their appropriate HTML entity as they are entered.

Good luck,
Csaba Gabor from Vienna

Jul 23 '05 #2
Spoke with Microsoft about this and apparently there is simply no way
to disable this.

It is hardcoded by IE mshtml.dll with all the following protocols:
www, http://, https://, ftp://, gopher://, mailto:, new:, snews:,
telnet:, wasis:, file://, nntp://, newsrc:, ldap://, ldaps://,
outlook:, mic:// and url:

The only workaround would be to use Javascript to detect and remove the
hyperlinks AFTER they have been created on each key press or click
event...

Guillaume

Csaba Gabor wrote:
gb********@gmail.com wrote:
Hello 'contentEditable' gurus,

The example code below uses contentEditable to let the user edit the

...
However, if the user edits the <div> by typing:
"jo**@doe.com is listed on the www.yahoo.com webpage"
IE 5.5+ automatically detects the email address and the URL and creates
those 2 hyperlinks automatically.


What a pain in the neck! Just some ideas for you... in case you
implement a solution, please do post it.

If you prefix the email or the web address with a double quote, IE
won't do the nasty. This, of course, is not an acceptable solution.

One possibility is to wait until the div loses the focus, and then do
something like mydiv.innerHTML = protect(mydiv.innerText). Still, the
user would be somewhat confused about what is going on. So, to ratchet
this up, you could do the same type of thing each time the div content
changes (however IE is buggy on this change detection, especially if
the entire element is erased. Example: type jo**@doe.foo, then HOME
(note link), then SHIFT+END, then x, then y, then z. HELLO, IE, anyone
at home?!? Note that xyz is shown as a link even though there is no
cause. Now hit the BACKSPACE. Ah, now IE has woken up again). Or a
variation on this theme would be to replace '@', '.', and ':' with
their appropriate HTML entity as they are entered.

Good luck,
Csaba Gabor from Vienna


Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Mickey Segal | last post by:
On comp.lang.java.programmer we are discussing problems created for Java programs by pop-up blockers (in the thread "showDocument blocked by new microsoft pop-up blocker"). Our problem is that...
1
by: Raed Sawalha | last post by:
Is it possible to make the following div to generate automatic line feed when user start writing and reaches the DIV bounderies like in textarea, the case I have when type a continous chars without...
3
by: nAmYzArC | last post by:
Hello every1, I have a "<DIV" tag with contenteditable turned on. I am using this as an area that users can either paste or drag/drop text into. The text can come from other browser windows and of...
1
by: Philip Bondi | last post by:
Hello to all SQL Server junkies who work with non-English characters: For people running scripts from the command line using ANSI files with special characters, it is very important to use isql...
4
by: venkatbo | last post by:
Hi folks, I'd like to disable the inclusion of tk graphics lib in my py build. Looked around but couldn't find a clear answer. Which one of the following would I need to use in the configure...
1
by: delraydog | last post by:
Does a contentEditable DIV have the notion of an internal document? I'm trying to convert code that uses an IFrame.contentWindow.document to use the "document" inside a contentEditable DIV but they...
58
by: Jorge Peixoto de Morais Neto | last post by:
I was reading the code of FFmpeg and it seems that they use malloc just too much. The problems and dangers of malloc are widely known. Malloc also has some overhead (although I don't know what is...
3
by: myjish18 | last post by:
Hello, We have a DB2 UDB database v8.2.7 (db2 v8.2 fixpak 14) on AIX 5.3 which has Automatic Storage (AS) enabled. We want to disable automatic storage on entire database and/or disable...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.