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

后端 未结 11 1863
傲寒
傲寒 2020-12-05 13:59

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 ca

11条回答
  •  生来不讨喜
    2020-12-05 14:36

    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

提交回复
热议问题