Internet Explorer Email Address Autolink -- Disable? - javascript

I'm trying to use a component called Codemirror for in-browser source code editing. It works great, but IE7 has a bug (feature?) that autolinks all email addresses that are typed into the code editing window.
For example, if I type String x = "me#mydomain.com";, IE turns this into String x = me#mydomain.com; -- it strips the quotes and underlines it.
Does anyone know how to override or disable this? Thank you.
-tjw

I have heard about Codemirror, but I did not used it yet, have you tried:
· Changing the # for #?
· Adding a part of the string to the other?
· Parsing the final result to String again?

Using single quotes instead of double should work. I've tested it in IE8 and IE9 RC1.

I presume the component is using a Web Browser Control under the covers, which seems like an odd choice. You can prevent automatic hyperlink generation using ExecCommand(IDM_AUTOURLDETECT_MODE); see http://msdn.microsoft.com/en-us/library/aa769893(v=vs.85).aspx
Prior to IE9, it was not possible to specify IDM_AUTOURLDETECT_MODE from JavaScript, meaning that pages could not disable automatic hyperlinking in ContentEditable areas. A new command constant AutoUrlDetect is supported in IE9, allowing script to disable automatic hyperlinking as follows: document.execCommand("AutoUrlDetect", false, false)

Related

Disable autocorrect / autocompletion in content editable div

I m developing a cross-browser application in Script#.
I m using a contenteditable div, where user can add text. But i dont want the auto correct/ auto completion feature to change the user text.
Plz tell me how can i disable this feature.
It should work on all platforms. ( iOS, Android, Windows)
I have tried autocorrect="off";
autocomplete="off"
but nothing is working. plz help....
What you can do is to use the attribute spellcheck=false. This is (in HTML5 CR) the defined way to disable “checking of spelling and grammar of editable text”. The default value of this element is browser-dependent, and the value may depend on element. E.g., in Chrome, the default is spellcheck=true for an element that has been made editable using the contenteditable attribute.
However, this affects (at most) only what happens in the browser. Software external to the browser, such as a system’s keyboard reading routines, are probably immune to anything you say in HTML.
You are using the correct attributes, but I'm not positive if they are expected to work with contenteditable (they are definitely supported for and tags). Current iOS versions(at least v6.1 and up) will currently support those attributes, however there is a bug in Chrome for Android not respecting these HTML 5 attributes. It appears to just recently have been fixed and hopefully should be released in an update soon.
https://code.google.com/p/chromium/issues/detail?id=303883&q=autocorrect&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified
Also feel free to Star the issue to help boost the ranking...

Javascript autocomplete works in IE and Chrome, doesn't work in Firefox

I'm working on a client's site which utilizes a Javascript autocomplete feature in the search form. The website is in Hebrew, but please don't let that scare you away - my issue is in code, not English. :)
Link: -removed by author-
Most of the autocompletion options are in Hebrew but I added "test" so that it will be easy to test in English as well.
Basically this autocomplete script generates a text input box, and when the user types in a letter (onkeyup), a list of common values are offered (e.g. "test").
This works fine in both Chrome and IE, but for some reason Firefox is behaving differently.
When you enter a letter in Firefox, according to the error console:
Error: searchResult1 is not defined
Source File:
Line: 1
Same goes for searchResult0 in the second input field (line ~460 in the source code).
If you look at -removed- the autocomplete script does work in Firefox, so I don't really know what it is I could have changed that broke its functionality.
Thank you for any help with this :)
The problem is onkeyup="searchResult1.style.visibility='visible';...", it should be document.getElementById('searchResult1').style.visibility - you are referring to an element by its ID. It's an old MSIE feature that elements with an ID turn into "global variables" but that's really not something you should use. Other browsers implemented support for this misfeature ("global scope pollution") to stay compatible with MSIE but it is merely a compatibility layer and only kicks in under certain conditions.
Why don't you try using jquery autocomplete plugin rather than writing something on your own. The javascript written is not proper.
Its best to use the jquery autocomplete plugin. I see in you code you are jquery1.5.2
Autocomplete Demo:
http://view.jquery.com/trunk/plugins/autocomplete/demo/
Download and documentation
http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/

Override IE email auto-formatting in rich-text editor

Our site makes use of FreeTextBox, a web-based, rich-text editor. In IE, but in not Firefox, if a user types in something like:
someone#blah
IE automatically creates a mailto hyperlink. I have tested this with other text editors out there and the story is the same with all of them.
Can I override this browser behavior somehow from within my application?
This has to do with the MSHTML editor, which (I'm guessing all) Windows browsers use to instantiate rich text editors. There's a setting called IDM_AUTOURLDETECT_MODE that lets you decide if the autolinking will take place, and the default is true (other browsers apparently set it to false on instantiation, hence no autolinking in Firefox.)
Unfortunately, until recently Microsoft didn't have a mapping from the command ID to a command identifier string, so the function wasn't accessible via Javascript prior to IE9.
I just tried it out in IE9 and can confirm that, for that version and presumably all future ones, you can override the feature by calling
document.execCommand("AutoUrlDetect", false, false);
Note that it's IE9+ only, so you're still stuck for previous versions, and that you'll want to wait until the DOM is loaded before you call it and have some error handling around it, etc, etc.
There's a good summary of the original issue here, and a discussion of the fix in the minor change list here.

Javascript: Workaround needed: Internet Explorer changes link text when changing the href

I have a problem as follows: We're using a rich text editor (TinyMCE, but that's not important here, I think) in our application. Now, with Internet Explorer 8, we've noticed that if you type in content that looks like a web address:
www.google.com
...IE helpfully converts it to a link by some native-to-browser functionality. Now if you really want to make it into a link, and choose to edit link properties, and set the href e.g. to
www.google.com/analytics
...then when the javascript sets the href attribute of the anchor tag, also the text of the link changes. The desired result is:
`www.google.com`
but actually is:
`www.google.com/analytics`
Does anyone know a way to work around this?
Update: This behavior has only been observed in Internet Explorer 8 and 7. Firefox, Chrome, and Safari are not affected. The problem can also be observed on the TinyMCE websitehttp://tinymce.moxiecode.com/examples/full.php, so it's probably not a TinyMCE configuration issue.
After some research and debugging, I found that the problem is caused by built-in behavior of Internet Explorer. It occurs when setting the href-property of a link, whose text-content appears to be an URL (according to IE). In these cases, IE copies the contents of the href-attribute into the link text.
There might be several workarounds for this, but I found that at least this logic works:
store the innerHTML into a temporary variable,
set the href attribute as usual
if innerHTML has changed, copy back the original innerHTML from the temporary variable.
This seems to work because changing the innerHTML of the link does not cause changing of the href attribute.
In tinyMCE, find the following line in setAllAttribs() of functions.js of the advlink plugin:
setAttrib(elm, 'href', href);
...and replace it with this monster:
if(tinyMCE.isMSIE) {
var tmp = elm.innerHTML;
setAttrib(elm, 'href', href);
if(elm.innerHTML != tmp) // optional, but keeps unnecessary innerHTML set:s away
elm.innerHTML = tmp;
}
else {
setAttrib(elm, 'href', href);
}
...and your links will appear as if untouched. I also started a thread on the tinyMCE forums about this. If they post some improvements to my solution or tell it's nonsense, I'll update this question also.
Need more information:
Does it behave the same way in other browsers?
Are you typing this into the rich text area, or the html view?
Have you configured TinyMCE properly? Sounds like a bug with your particular implementation -- it is not parsing out the HTML tags properly.

What Javascript rich text editor will not break the browser's spellcheck?

I'm using TinyMCE in an ASP.Net project, and I need a spell check. The only TinyMCE plugins I've found use PHP on the server side, and I guess I could just break down and install PHP on my server and do that, but quite frankly, what a pain. I don't want to do that.
As it turns out, Firefox's built-in spell check will work fine for me, but it doesn't seem to work on TinyMCE editor boxes. I've enabled the gecko_spellcheck option, which is supposed to fix it, but it doesn't.
Does anybody know of a nice rich-text editor that doesn't break the browser's spell check?
TinyMCE only goes out of its way to disable spell-checking when you don't specify the gecko_spellcheck option (i verified this with their example code). Might want to double-check your tinyMCE.init() call - it should look something like this:
tinyMCE.init({
mode : "textareas",
theme : "simple",
gecko_spellcheck : true
});
Most rich text editors let you specify whether or not to disable the browser's spellchecker (as answered by others), with the exception of those running in Safari.
There is currently no way to programmatically disable the Safari spellchecker (as there is in FF and IE7+), so most rich text editors choose to let Safari do its own thing by leaving the browser in control of the context menu.
I know at least yahoo!'s Rich Text Editor will let you use the included spell checker in FireFox.
I also tested FCKeditor, but that requires the users to install additional plugins on their computer.

Categories

Resources