I have a particular set of pages which is feezing both newer IE browsers and their debuggers (and probably the older as well). No error messages: an outright freeze. Basically, there's a parent .asp page with an iframe. The iframe's content is generated by a call to a javascript function from the parent and written by document.writes. The iframe's content is written at page load, and rewritten everytime a selection is made in the parent page, which recalls the function and rewrites the iframe's content using changed variables which both share. the iframe's dynamically rendered document contains both inline script (of the form <script type='text/javascript>function foo() {}</script>) and included javascript files (of the form <script src=something.js type='text/javascript'></script>). evidently this is what freezes the IE browsers. If the iframe content contains both inline and outside javascript files, the browser freezes in the middle of loading the parent page (which, you remember, also produces the iframe content initially). There is no problem with other browsers' accessing the same content. Is there something simple I'm missing? I have a complete test case: the parent page containing the iframe, the script which puts minimal content into the iframe, and a dummy outside javascript file to be referenced in the iframe content. This is the problem reduced to its simplest terms, if you want to put it on the server, here it is: //this is "Something.asp", the parent page. notice that it is written on the server, but, or course, appears to the browser as html. It sets up an iframe. then it calls a function (writesomething() in an outside file: something.js, which provides markup to the iframe... <%@ LANGUAGE = "JavaScript" %><% Response.Write("<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>\r"); Response.Write("<html lang='en'>\r"); Response.Write("<head>\r"); Response.Write("<meta http-equiv='content-type' content='text/html; charset=UTF-8' />\r"); Response.Write("<meta name='description' content=' ' />\r"); Response.Write("<meta name='keywords' content=' ' />\r"); Response.Write("<meta name='Author' content='DA Ward - daward@worldnet.att.net' />\r"); Response.Write("<meta name='copyright' content='© 2009 DA Ward, Associates' />\r"); Response.Write("<title>IE 8 Flaw master page</title>\r"); Response.Write("<style type='text/css'>\r\r"); Response.Write("<style type='text/css'>\r\r"); Response.Write("body {color:black; font-size:24px; text-align:center; width:980px; height:600px;}\r\r"); Response.Write("</style>\r\r"); Response.Write("<Script type='text/javascript' src='something.js'></Script>\r\r"); Response.Write("<body>\r"); Response.Write("<div style='float:left; width:980px;'>\r"); Response.Write("<div style='float:left; width:260px; padding:40px 20px;'>\r"); Response.Write("This is the server page, which sets markup and calls something.js.<br><br>Something.js writes its own markup into the iframe on the right.<br><br>As it's coded now, the page loads.<br><br>To freeze the browser, uncomment the lines at the end of something.js.<br><br>If you play around, you'll see that IE browsers accept (in something.js) an imported .js file or a native function, but not both (without freezing).<br><br>This behaviour has totally scuttled the site I'm working on...\r"); Response.Write("</div>\r\r"); Response.Write("<div style='float:left; width:680px;'>\r"); Response.Write("<iframe name='somethingholder' id='somethingholder' style='width:600px; height:350px; padding:40px;' src='dummy.htm' allowtransparency='true'></iframe>\r\r"); Response.Write("</div>\r\r"); Response.Write("</div>\r\r"); Response.Write("</body>\r"); Response.Write("</html>\r\r"); Response.Write("<SCRIPT type='text/javascript'>\r"); Response.Write("writesomething()\r"); Response.Write("</SCRIPT>\r"); %> //this is the function that writes to the iframe: call it "something.js". Save it in the same folder as the rest. function writesomething () { var odoc = frames['somethingholder'].document; odoc.write("<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>\r"); odoc.write("<html lang='en'>\r"); odoc.write("<head>\r"); odoc.write("<meta http-equiv='content-type' content='text/html; charset=UTF-8' />\r"); odoc.write("<meta name='description' content=' ' />\r"); odoc.write("<meta name='keywords' content=' ' />\r"); odoc.write("<meta name='Author' content='DA Ward - daward@worldnet.att.net' />\r"); odoc.write("<meta name='copyright' content='© 2009 DA Ward, Associates' />\r"); odoc.write("<title>IE 8 Flaw iframe written by Jscript</title>\r"); odoc.write("<style type='text/css'>\r\r"); odoc.write("h1 {color:red; font-size:30px;}\r\r"); odoc.write("</style>\r\r"); odoc.write("<body>\r"); odoc.write("<h1>Something.js writes the content of this iFrame. Examine it's code.<br><br>Uncomment lines to freeze IE 8 and 7.<br><br>Works fine in Firefox, Chrome, and Safari...</h1>\r"); odoc.write("</body>\r</html>\r\r"); odoc.write("<script src='importedsomething.js' type='text/javascript'></script>\r\r"); //odoc.write("<script type='text/javascript'>\r\r"); //odoc.write("function inlinesomething () {var xxxmmm = 'foo'};\r\r"); //odoc.write("</script>"); odoc.close(); // this is any old outside javascript file: call it "importedsomething.js" and put it in the same folder as all the others. It is the script referenced in the iframe. function importedsomething () { var somethingelse = "see, I told you...!" } //this is dummy.htm . It is the temporary content of the iFrame until something.js refills it. <HTML><BODY STYLE='background-color:#FFEEFF;'><CENTER>please wait a moment....</CENTER></BODY></HTML>
↧
Inline script with included script in iframe freezes IE 7 & 8
↧