window.name
来源:互联网 发布:云服务器ecs绑定域名 编辑:程序博客网 时间:2024/06/16 00:42
<!DOCTYPE html><!DOCTYPE html><html> <head> <meta charset="utf-8"> <title>第二个页面</title> </head> <body> <h1>第二个页面</h1> <div></div> <script type="text/javascript"> window.onload = function(){ //window.parent, 拿到01.html的window对象 var parentWindow = window.parent; document.querySelector('div').innerHTML = parentWindow.name; } </script> </body></html>
<html> <head> <meta charset="utf-8"> <title>第一个文件</title> </head> <body> <h1>第一个文件</h1> <script type="text/javascript"> var data = { value: "第一个文件" }; window.name = JSON.stringify(data); </script> <!-- 测试同源:按照相对路径引入02.html 测试不同源: 将02.html放到一个其他的主机下 --> <!-- <iframe id="frame" src="./02.html" width="600" height="300" frameborder="1"></iframe> --> <iframe id="frame" src="http://127.0.0.1:8085/window.name/03.html" width="600" height="300" frameborder="1"></iframe> <script type="text/javascript"> window.onload = function(){ var frame = document.querySelector('#frame'); //02.html页面的window对象 // console.log(frame.contentWindow); //iframe页面的window在不同源的页面之间无法获得!!!!!!!! // iframe 允许跨域加载页面,但是不允许跨域修改 var subWindow = frame.contentWindow; subWindow.document.querySelector("h1").innerHTML = "我被主页面修改了"; subWindow.document.querySelector("h1").style.color = "red"; } </script> </body></html>
阅读全文
0 0
- window.name
- window.name==window['name']
- window.name做跨域应用
- js中 window[Name]
- 跨域--window.name + iframe
- JS跨域:window.postMessage + window.name +jsonp
- window.open(pageURL,name,parameters)
- Get window name using xprop
- window.name实现跨域
- iframe 中使用 window.name
- Window.name实现跨域
- 怎样利用window.name跨域
- window.(url,name,param) 使用
- 神奇的window.name:不要声明全局变量name
- window.name实现ajax跨域post请求
- 利用window.name解决跨域问题
- 实战window.name解决跨域问题
- window.name实现的跨域数据传输
- 一些工具的安装
- 数据加密
- css的伪类和伪元素
- linux mint:关于解决安装中文输入法之后字体变化的问题
- C++学习过程笔记(1)
- window.name
- 学习各种动画,效果等,掌握其实现原理
- 通过newFixedThreadPool创建线程代码
- typedef struct和struct区别
- Linux下按扇区读写块设备
- JBDC介绍
- 存储过程和触发器
- 欢迎使用CSDN-markdown编辑器
- ue4 打中物体,物体销毁