Click to See Complete Forum and Search --> : document.write() makes IE hang
epowder
10-17-2003, 10:52 AM
var newWin = window.open('','');
newWin.document.write("<html><head><scrip"+"t type=\"text/javascript\" Language=\"JavaScript\" src=\"functions.js\"></scrip"+"t></head>");
newWin.document.write("<body></body></html>");
newWin.document.close();
This makes IEv6 hang when run remotely. SO ONLINE, not locally.
anybody know why ?
thanks
or better: a way to fix it ( the problem is in the external js reference)
Phil Karras
10-17-2003, 11:22 AM
Seems to "work" here in IE 6.0
The blank page opened had the following HTML in it (all on one line):
<html><head>
<script type="text/javascript" Language="JavaScript" src="functions.js">
</script>
</head>
<body></body>
</html>
The functions.js file MUST be in the same location as the HTML file calling it in.
If it is not, then it won't have those functions, whatever they are, as I don't.
OR, you'll need to include the entire path to the *.js file.
epowder
10-17-2003, 11:28 AM
it works locally, not when i put it online
did you test that remotely ?can you then give me the url please
Phil Karras
10-17-2003, 02:30 PM
Yup, I see the problem. I've put it up on my test site:
http://www.cs.yrex.com/
in help/help268.htm
Like yours it hangs IE6 - turns out for some reason it is taking 70 - 97% of CPU time, so there's something
strange going on. Perhaps with the way you've opened the new window?
I'll try a few things to see what shakes loose.
OK, here's what I've found out so far:
1. var newWin = window.open('',''); // This is one thing that causes it to lock-up
Change it to something like:
var newWin = window.open('blank.htm','empty');
where blank.htm is a real file.
2. No matter what kind of js file I used, including one that simply had a
single alert statement in it, it would lock-up
Interestingly enough this does NOT lock-up:
newWin.document.write("<html><head><script type='text/javascript' Language='JavaScript'>alert('Now in TEST');</script></head>");
So, you can write your own JavaScript functions into the HTML file but for some
reason IE6 is not allowing one to load in a JS file when the HTML is being written
into the newly opened window.
By the way, every now and then I got it to work in IE, but I haven't been able
to figure out why yet.
NOTE: I have no problem when I use NS6.1, it can use test.js just fine.
epowder
10-18-2003, 05:10 AM
indeed, writing the javascript itself works fine
but in this case that is not desirable as i would like the page to have quite a lot functions
thanks anyway for trying to help out, it's really appreciated
Khalid Ali
10-18-2003, 08:01 AM
You did not have to post multiple posts for one question,be patient.read the "Message Posting Guidelines" above.