当前位置:网站首页>Learn iframes and use them to solve cross-domain problems
Learn iframes and use them to solve cross-domain problems
2022-08-04 03:35:00 【M78_Domestic 007】
Learn about iframes
The official definition is: iframe is HTML tag, which acts as a document in a document, or floatsframe (FRAME).The iframe element creates an inline frame (ie, an inline frame) that contains another document.
Simply understood as: iframe is an inline frame that can embed another document in the current HTML page.
iframe attributes
Only common attributes are introduced here
name: Specifies the name of the
width: Specifies the width of the
height: Specifies the height of the
src: Specifies the URL of the document displayed in the
frameborder: HTML5 not supported.Specifies whether to display a border around the
scrolling: HTML5 not supported.Specifies whether to display scrollbars in the
align: HTML5 not supported.HTML 4.01 is obsolete.Specifies how to align the
Simple demo:
Demonstrate the use of iframe
We set an inline frame named ifr with a width of 600 and a height of 400, showing the border, hiding the slider, and showing the document as site b (you can also choose a local html document).We can write a text description in the iframe tag, because some low-version browsers do not support this tag, and when the document cannot be displayed, the text we wrote will be displayed on the page.
Open the browser to see the effect:

Get the content inside the iframe
Demonstrate the use of iframe
Resolving cross-domain issues
1. document.domain+iframe
This method can only be used for cross-domain requests between different subdomains under the same main domain, such as between a.com and 1.a.com, and between 1.a.com and 2.a.com.
Just point the document.domian of both pages to the main domain, such as document.domain="a.com".
The parent page embeds the child page through iframe, obtains the window of the child page through iframe.contentWindow, and then operates the child page, and the child page accesses the window of the parent page through parent.window and parent.
Write an example:
//Parent page http://a.com/a.html//Subpage http://1.a.com/b.htmldocument.domain="a.com"var name2=2//Get the properties of the parent pagevar name11=parent.window.name12. window.name+iframe
The implementation is to pass data based on window.name.name is a property of the global window object in the browser environment.
When a new page is loaded in an iframe, the value of the name property remains the same.
边栏推荐
- 从图文展示到以云为核,第五代验证码独有的策略情报能力
- How to read the resources files in the directory path?
- 2022年最新海南建筑八大员(材料员)模拟考试试题及答案
- Introduction to the memory model of the JVM
- base address: environment variable
- 网络工程师入门必懂华为认证体系,附系统学习路线分享
- There are too many systems, how to realize multi-account interworking?
- 数据安全峰会2022 | 美创DSM获颁“数据安全产品能力验证计划”评测证书
- 一文详解DHCP原理及配置
- 案例 | 重庆银行流动数据安全挑战及应对实践
猜你喜欢

函数,递归以及dom简单操作

MySQL query optimization and tuning

案例 | 重庆银行流动数据安全挑战及应对实践

4-way two-way HDMI integrated business high-definition video optical transceiver 8-way HDMI high-definition video optical transceiver

劝退背后。
![出现504怎么办?由于服务器更新导致的博客报504错误[详细记录]](/img/e0/32d78fac04dc2deb1cb1f847a7bab5.png)
出现504怎么办?由于服务器更新导致的博客报504错误[详细记录]

Implementing a server-side message active push solution based on SSE

STM8S project creation (STVD creation) --- use COSMIC to create a C language project
![[Study Notes Dish Dog Learning C] Dynamic Memory Management](/img/57/a1837e5eec2af0e684e5895a8afed0.png)
[Study Notes Dish Dog Learning C] Dynamic Memory Management

Introduction to mq application scenarios
随机推荐
数据集类型转换—TFRecords文件
C语言--环形缓存区
mq应用场景介绍
返回字符串中的最大回文数
docker+网桥+redis主从+哨兵模式
力扣(LeetCode)215. 数组中的第K个最大元素(2022.08.03)
JVM内存和垃圾回收-07.堆
初识Numpy
TOML configuration file format, YAML's top contender
[Playwright Test Tutorial] 5 minutes to get started
Mockito单元测试
数据安全峰会2022 | 美创DSM获颁“数据安全产品能力验证计划”评测证书
Innovation and Integration | Huaqiu Empowerment Helps OpenHarmony Ecological Hardware Development and Landing
嵌入式数据库开发编程MySQL(全)
目标检测-中篇
移动支付线上线下支付场景
base address: environment variable
FPGA parsing B code----serial 3
一文详解DHCP原理及配置
Basic form validation process