Home >Web Front-end >HTML Tutorial >contenteditable input URL problem. Waiting online. . _html/css_WEB-ITnose

contenteditable input URL problem. Waiting online. . _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:25:561510browse

contenteditable URL contenteditable URL hyperlink

Come to the rescue.
After adding contenteditable="true" to the html element attribute
How to control the input of content like www.baidu.com
Prevent it from automatically becoming a hyperlink! ! !

Reply to discussion (solution)

html element attributes
re: What element is used for
?

uses body. If you can use other elements to solve this problem, it is also possible. It does not have to be body

html element attribute
re:
What element is used?

Use body. If you can use other elements to solve this problem, it is also possible. It does not have to be body.

Use designMode instead.

Use designMode instead.

Why didn’t I find it turned into a connection?


Use designMode instead to implement

Why didn’t I notice it turned into a connection?
In IE Next time

switch to the designMode method to implement

editDocument.designMode = "on";
editing can be achieved, but entering www.baidu.com will still become a hyperlink.



Use designMode instead to implement it

Why didn’t I find that it turned into a connection?
It does in IE.
What should I do? Is there any way to intercept it and prevent it from automatically converting it for me? I can look at the Baidu Tieba and enter the URL or something.

Not tested under IE

window.onload=function(){document.execCommand("AutoUrlDetect", false, false);}</script>

Not tested under IE

window.onload=function(){document.execCommand("AutoUrlDetect", false, false);}</script>

Thank you so much. . I had thought before that there should be such a command, but I couldn't find it in the documentation.
I also hope you can give the document path of command identifiers.
I have tested it in IE and Chrome Firefox.
Strongly tell me where you saw command identifiers

document.execCommand("AutoUrlDetect", false, false); Valid
I have not seen it in the command of execCommand


Not tested in IE

window.onload=function(){document.execCommand("AutoUrlDetect", false, false);}</script>

Thank you so much. . I had thought before that there should be such a command, but I couldn't find it in the documentation.
I also hope you can give the document path of command identifiers.
I have tested it in IE and Chrome Firefox.
Strongly tell me where you saw command identifiers

msdn: http://msdn.microsoft.com/en-us/library/aa769893(v=vs.85).aspx

stackoverflow.com: http://stackoverflow.com/questions/7556007/avoid-transformation-text-to-link-ie-contenteditable-mode



Not in ie Test next

window.onload=function(){document.execCommand("AutoUrlDetect", false, false);}</script>

Thank you so much. . I had thought before that there should be such a command, but I couldn't find it in the documentation.
I also hope you can give the document path of command identifiers.
I have tested it in IE and Chrome Firefox.
Strongly tell me where you saw command identifiers

msdn: http://msdn.microsoft.com/en-us/library/aa769893(v=vs.85).aspx

stackoverflow.com: http://stackoverflow.com/questions/7556007/avoid-transformation-text-to-link-ie-contenteditable-mode
Why is it that if I use it like this, it will prompt that the parameter is invalid?

The parameter is invalid. Oh my god, how can I change the question sheet?

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn