Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
162 views
in Technique[技术] by (71.8m points)

javascript - IE 9 and IE 10 cannot enter text into input text boxes from time to time

There is a web page with an iframe inside. Sometimes, Input text box controls, inside the iframe, are locked/ freezed. Users cannot enter text into them. But the text box can be focused and not faded. There is no code to disable the input controls and this does not always happen. Up until now, this is happening only in IE 9 and IE 10. Firefox and Chrome is OK.

Brief description of how the page works is:

  • There is a button on the parent page. By clicking it will build an iframe from scratch and show it. This is done by Javascript.

  • Again, there is a button on the iframe to close it. By clicking it
    will remove the iframe from the parent page's DOM.

Please let me know if you want further information as required. Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This bug is very annoying, even worse there was very few informations we could find on google.

There is only one link from Microsoft that about IE9, but problem still exists in IE10 / IE11 and much easier to reproduce.

I have just create a fiddle to describe this problem

http://jsfiddle.net/WilliamLeung/T3JP9/1/

Why it is so hard for M$ to fix this issue for years?

there should be three workarounds

  1. Reset the focus every time we modify the DOM with iframe
  2. or schedule a "do nothing" time consuming task, which may make IE response to mouse event magically, I could not tell you why, maybe M$ could

    The sample codes which setup a time consuming task

    setInterval(function () {
        var loopCount = 10000;
        var x = 0;
        for (var i = 0; i < loopCount; i++) {
            x = (x + Math.random() * 1000) >>> 0;
        }
        return x;
    }, 1000);
    
  3. or reset the DOM content before remove it from document

    someDivWithIframe.innerHTML = "";
    $(someDivWithIframe).remove();
    

    I am not sure if it helps for all cases, you should have a tried


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...