Home > Web Front-end > HTML Tutorial > How to use iframe across domains

How to use iframe across domains

php中世界最好的语言
Release: 2018-03-09 10:47:08
Original
3019 people have browsed it

This time I will bring you the cross-domain usage of iframe. We know that in the front-end interface, we often use the iframe tag, so what are the precautions for the cross-domain use of iframe, as follows This is a practical case, let’s take a look at it.

Under the same origin:
The parent page can directly access the iframe's global variables, DOM tree, etc. through iframe.contentWindow. The iframe can also do the same to the parent page through parent/top. things.

Under different origins:
The standard method is to communicate with each other through .postMessage(), and the non-standard method is to use location.hash and other tricks. The protocol, domain name, and port number jointly determine an origin.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to the php Chinese website Other related articles!

Related reading:

Detailed explanation of using bootstrap-validator

What are the length units in css

What you need to know to get started with HTML

Inline style improvements in HTML "San Mao's Classic Quotes"

Use React to complete a picture carousel component


The above is the detailed content of How to use iframe across domains. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template