One, the same domain
1. If we want to manipulate the elements inside the IFRAME, first get to the window of the introduced page. Gets the window object inside the IFRAME.
var oiframe=getelementsbytagname (' iframe ') [0].contentwindow;
You can then manipulate the DOM elements inside the IFRAME.
2.window.open () method
The window.open () method returns a Window object for the page being opened.
var newwindow=window.open (' xx.html ', ' _blank ');
Manipulate the DOM elements of a child page by NewWindow.
Second, cross-domain
1.postMessage: This object can be used to send a message to another window. The Window object that accepts Windows. PostMessage ().
Likewise we get the Window object under the IFRAME var oiframe=getelementsbytagname (' iframe ') [0].contentwindow; then send the message oiframe.postmessage (' Parameter a ', ' parameter B ');
Parameter A: Indicates that the sent data parameter B indicates the domain name that accepts the parameter (to bring the Protocol)
Finally, the event is triggered when the Accept Parameters page receives the mesage information. Can write like this
Window.addeventlistener ("Message", function (EV) {
Ev.data------This is the parameter a, take this number to judge, thus to operate this savage window;
Ev.origin-----The source of the data sent;
},false)
2-Word Page Action parent page
Window---refers to the current window page The parent---refers to the window object that contains the parent page of the current page. Top-----refers to the top-level window object.
Three,
Cross-domain resolution under AJAX requests
Header (' access-control-allow-origin:http://www.a.com '); This is the code that allows access to the resource's domain setting as follows
Cross-domain implementation under IE
Under the same domain, XMLHttpRequest
Cross-domain: oxdomainrequest
Event is onload event
HTML5 the same domain and cross-domain communication between windows