Background: We're using the webbrowser control in a windows forms .net 4 project. This is to allow users to edit the text of html emails.
Problem:
Can we stop the webbrowser c开发者_高级运维ontrol auto-correcting text the user types in?
For example the user types the text http://www.randomwebsite.com
then the web browser control "helpfully" wraps that text with an <A> tag
.
I want to stop this behaviour if at all possible,
The end game:
Ultimately what I'm trying to achieve is to allow users to put a URL to an image in and use data tags from my system to fill in part of the URL. At the moment the user will have to go into a view source view and remove the A tags to get it to work, which is a very poor solution...
I can hear the support desk phones ringing already!!
At the moment, the only solution I have found is to trap the keyup
event, select the text using a TextRange
and then use ExecCommand("unlink")
to remove the automated link.
It has the disadvantage of being ugly as the link is shown then disappears but it does work.
精彩评论