1) Cross-Origin
Because of the same-origin policy ( The same-origin policy is a client script (especiallyJavascript. It was first fromNetscape navigator2.0To prevent a document or script from being loaded from multiple sources. The same source indicates the same protocol, the same domain name and the same port. ). Due to browser security restrictions, Ajax cannot be submitted across domains. JS cannot call functions across domains.
There are many online solutions. I use IFRAME + domain. I set domian in two different subdomains, by setting a proxy page, direct the SRC of IFRAME to this proxy page and call the method of the parent page on this proxy page. the proxy page and the current page are under the same domain name.
2) IFRAME usage Summary
(1) IFRAME + post for cross-origin submission
(2) You can perform page operations to modify the SRC content of IFRAME and process cross-origin requests.
(3) contentWindow & contentdocument controls the DOM content on the IFRAME page. contentWindow is the window on the page inside IFRAME, while contentdocument is the document on the IFRAME page, generally, contentWindow is compatible in browsers.
(4) When controlling the content of pages in IFRAME, the parent page must be loaded. Otherwise, an error will be reported.
(5) If the border of IFRAME is 0, frameborder = 0 is used, and no scroll bar is used, scrolling = No
3) button creation: Use the tag to facilitate multiple changes. Note that the control button is only clicked once.
4) summarize the form,