I located a xml document with Javascript's window.open, but I cannot access the new window after the document loaded: mywin = window.open("_Blank", "mywin"); alert (mywin.closed); mywin.location = "http://127.0.0.1:8899/mydoc.xml"; alert (mywin.closed); I get a "false" at the first alert and a "true" at the second alert. I don't know why this happens. If I locate a html document, the two alert was all "false".
The correct syntax should be: mywin = window.open("","_blank", "mywin"); Code (markup): Anyway, i doubt that this is the issue, so two other problems could be the case: 1. test if the .xml document on that port could be accessed from that place 2. maybe the .xml file runs with a different file handler, so the browser try to save it or open it with a tool like xmlspy, notepad++ or anything else Regard
I tried to open a local xml file such as "file:///d:/temp/./test.xml", the file load correct, but got the same result. But If I open a window with the same name after loading the xml document, I can get the correct handle: mywin = window.open("", "_Blank", "mywin"); alert (mywin.closed); mywin.location = "http://127.0.0.1:8899/mydoc.xml"; alert (mywin.closed); mywin = window.open("", "", "mywin"); alert (mywin.closed); After the second window.open, I can use the window. I suppose the reason as below: 1. As describes in some Javascript documents, when a new page is loading, window object is cleared as the page is unlaoded. 2. Usually, when a html page is loaded, It use the same window object, and the window is opened again. so we can use a variable to store the window object and use it in global. 3. But when a xml document is loaded, IE use a new ActiveXObject to load xml document, just as we do the same thing with Javascript. The ActiveXObject may create a new window object with the same name as the old one, then the old one is discarded! I don't know whether it is correct. Any one should make it clear and solve the problem?