1

Tried not working this is an compatability issue Ie9 vs IE11:

<iframe name="testwindowframe" id="testwindowframe" Onload="readyStateChange()" width="100%" height="90%"></iframe> 

Actual JSP: Please find the details :WHERE IFRAME AND SCRIPTS used this is an compatibility issue in IE11. I placed a breakpoint in the readyStateChange() but its not triggering.

<script language="javascript">
    function readyStateChange() {
        console.log('REACHED!');
    }
</script>

<iframe name="testwindowframe" id="testwindowframe" onreadystatechange="readyStateChange()" width="100%" height="90%"></iframe>
  • Well, [` – Mr. Polywhirl Nov 10 '14 at 00:45
  • 2
    ["The following objects always fire the event because they load data: applet, Document, frame, frameSet, ***iframe***, img, link, object, script, and xml elements."](https://docs.webplatform.org/wiki/dom/Element/readystatechange). See also: [IE11 onreadystatechange event not firing](https://social.msdn.microsoft.com/forums/ie/en-us/6981866f-b548-42e4-a259-a66a5cafb380/ie11-onreadystatechange-event-not-firing). Basically: *the `onreadystatechange` event is not being adopted by W3C since ages! And the result: IE11 has finally dropped it"* – Mr. Polywhirl Nov 10 '14 at 00:48
  • [Mr.Polywhirl] lease find the code for readyStatechange().script is in same jsp . –  Nov 10 '14 at 01:06
  • Is this function declared in the `` element of your HTML document? Have you tried to place a breakpoint in that function or place a `console.log("Calling readyStateChange()")` print statement in the function to see if it was actually called? Paste your JSP file with the JavaScript in-tact and obfuscate any information on that page that does not deal with this question... – Mr. Polywhirl Nov 10 '14 at 01:13
  • Mr.Polywhirl please find the jsp . I put a breakpoint in the method but its not reaching. –  Nov 10 '14 at 01:38
  • Does the script get placed in the ``, looks like you just add it to the body? – Mr. Polywhirl Nov 10 '14 at 01:39
  • Considered/tried using Ajax (asynchronous [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest))? – Protomen Nov 10 '14 at 01:47
  • by placiing the script inside the head will help to resolve the issue? –  Nov 10 '14 at 01:58
  • This has been tagged as JavaScript, no need to edit the title to be redundant, and what significance does it serve to change the `id` and `name` attributes of your original code, these are meaningless to the context in which you ask your question. Heavily editing your post confused people down the road. If you need to ask another question, please create a new question. – Mr. Polywhirl Apr 10 '15 at 10:39

2 Answers2

5

The attributes and event associated with checking the ready-state changes for <iframe> have been discontinued by Internet Explorer 11.

The following sums this up:

"The MSDN readyState property documentation points to the (on)readystatechange event documentation, which plainly states that an iframe supports these things. But it apparently doesn't anymore with IE11. It looks like IE11 is following W3C specs for this particular thing. This spec showsglobal attributes and events. (readyState/readystatechange isn't global, naming only document and media elements). This spec shows iframe implements load/onload, but not readyState attribute or readystatechange event)." [4]

"The point is that the onreadystatechange event is not being adopted by W3C since ages! And the result: IE11 has finally dropped it!" [4]

Also note that dynamically attaching an event on an iframe is inadvisable due to security and cross-domain restrictions when attempting to access a frame. [5]

Example

This code following code works in IE11, it will produce an alert when the <iframe> is loading.

function readyStateChange() {
    alert('The document ready state is "' + document.readyState + '".');
}
<iframe name="pdfFrame" id="pdfFrame" onReadyStateChange="readyStateChange()" width="100%" height="90%"></iframe>

Sources

Documentation

Forum Questions

Stack Questions

Community
  • 1
  • 1
Mr. Polywhirl
  • 42,981
  • 12
  • 84
  • 132
0

Try writing the function readyStateChange() in document.ready

Pallavi
  • 36
  • 3