For the third party integration, the author used & LT; iframe> , through the js of the child page to adjust the elements of the parent page, there will be access to the situation. The reason for this problem is that js does not belong to the same domain, so it is forbidden to access due to the security problem of some browsers.
resources: https://developer.mozilla.org/Cn/JavaScript the same-origin policy (such as can not access, HTTP) instead of HTTPS for
File: http://sub.xxx.com/index.html
& lt; ! doctype html>
< html>
< head>
…
< /head>
< body>
…
& lt; iframe id=”iframe_xxxx” name=”iframe_xxxx” src =”http://www.xxx.com/sub.html” frameborder=”0″ height=”300″ width=”1000″> < /iframe>
< /body>
< /html>
File: http://www.xxx.com/sub.html
& lt; ! doctype html>
< html>
< head>
< script type=”text/javascript”>
// set domain information
document.domain = ‘xxx.com’;
// set domain information
document.domain = ‘xxx.com’;
// set the iframe height of the parent page to reference itself
function setHeight(){
//
if(window.top! = window. Self) {
the parent. The document. The getElementById (‘ iframe_xxxx). Height = document. The body. The scrollHeight + 20
}
} & lt; /script>
< /head>
< Body &western nl &western AD = “setHeight ();” >
…
< /body>
< /html>
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
the problem is caused by the browser’s security mechanism,
but it is under the same domain subdomain and secondary subdomain difference, can be solved.
the solution is to change the domain information of the two pages to be the same.
because the default page’s domain information contains the second-level domain, this setting allows the use of the top-level domain as the domain information.
< script type=”text/javascript”>
document.domain = ‘xxx.com’;
< /script>
Note: This method is not feasible if two pages do not belong to the same domain name. Forced setting js will report an error. Addition: if we are not sure whether the referenced page is in the same domain as the referenced page, we can determine this by obtaining the url address of the referenced page
< script type=”text/javascript”>
//document.referrer – returns the URL of the document that was loaded with the current document.
$p_url = document.referrer;
< /script>
//= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Reference: http://hi.baidu.com/eecc00/item/7c99477420e9f1345c1789e3
Read More:
- Error: permission denied to access property “ref”
- Asynchronous loading JS does not allow the use of document write solution
- The document “ostream” could not be saved. You don’t have permission
- C / C + + error handling (document): unhandled exception: 0xc0000005: access violation while reading location 0x00000000
- NS_ERROR_DOM_BAD_URI: Access to restricted URI denied
- NPM ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
- Nginx configures different domain names to access different projects
- The Spring problem Failed to read Schema Document
- Content rendering error: a solution to the problem of zero Download document cannot be opened
- ER_ACCESS_DENIED_ERROR: Access denied for user ‘root‘@‘localhost‘ (using password: NO)
- There was an internal error, and Internet Explorer is unable to print this document
- Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’ npm ERR! at Error (native)
- Convert document txt to UNIX code under Linux
- VS2008 comes with crystal reports: Failed to Save Document
- Unable to read Scheme Document ‘ http://www.springframework.org/schema/beans/spring-beans-4.1.xsd ‘ [How to Fix]
- JavaScript / JS native dynamic introduction of external CSS files and dynamic insertion of CSS code fragments
- Solved: No’Access-Control-Allow-Origin’ cross-domain issue
- DOMException: play() failed because the user didn‘t interact with the document first
- Permission error: [errno 13] permission denied: ‘… ” xxx.pyd ‘
- Unable to read scheme document‘ http://www.springframework.org/schema/spring-context.xsd The solution to the problem