Webpage: a.html B .html
Link: add an iframein the.html page, and its srcamedirects to B .html.
Problem: the "Access Denied" script error will be reported when using the assumument. If you use the round-robin method to access the document, the same error will be reported several times at the beginning, and then it will be displayed and operated properly.
Reason excluded:
1. The two pages belong to the resource file of the same site, without cross-origin access, and the two pages belong to the same domain, that is, the document. domain attributes are consistent.
The IFRAME in 22.16a.html page does not affect the error in both dynamic creation and fixed generation on the webpage. The only difference is that when detecting the loading status of IFRAME, the status order of dynamic creation is uninitialized-> loading-> loaded-> interactive-> complete, the status order of a fixed generation is complete-> loading-> loaded-> interactive-> complete.
Analysis:
After the IFRAME is loaded in the completed state, it can normally access and modify the document object whose SRC points, it indicates that the process of loading IFRAME to the parent page is still unable to access the Document Object introduced by IFRAME, or the IFRAME may not be fully loaded when the parent page is displayed, therefore, an error message indicating Access Denied is displayed.
Modify the script comments:
If the ID of the IFRAME in the hypothetical a.html page is named IFR, you need to adjustCodeOnly one
If (document. readystate = "complete" & IFR. readystate = "complete "){
// Access and operate the Document Object introduced by IFRAME here
}