window.document is set null after saving a file

  • Thread starter Thread starter CP
  • Start date Start date
C

CP

A html page couldn't access its window.document object in
a javascript function, which IE claims it is null after
doing some events. Shouldn't each page be accessible to
its window.document object all the times?

This problem arises when the browser receives a page with
header "Content-Disposition".

Here is my situation:

1. Suppose a page currently open in IE sends a post to
another jsp, second.jsp, on a sumbit.

2. second.jsp invokes a tag, tag.java, which processes the
request parameters and writing back a page with
header "Content-Disposition" because it wants to prompt
users for saving a file to disk.

3. At the end of the post event, the browser window still
contains the original page.

4. Then, a new popup window, corresponding to "Content-
Disposition" page, prompts for saving to a file.

5. I proceed with saving to a file and close the pop up.

6. Back to original page, one that did the post in the
first place, I click on a button which invokes a
javascript function that accesses window.document. Intead
of proceeding smoothly as expected, it open an error box:

A Runtime Error has occurred.
Do you wish to Debug?

Line:81
Error: Access is denied

Yes button No button


instead. I confirm through alert statements that
window.document is null. I think window.document's value
in the original page may have been inadvertently cleared
out by one of the steps in the popup's file save.

However, if the original page get reloaded somehow, the
window.document object is restored.

I ran the same code in Netscape 7.1, it works fine.

Has anyone seen this problem before in IE6. Any helps is
greatly appreciated. Thanks in advance.


Regards,
CP
 
Back
Top