14.4 window.name
发布时间:2020-12-14 02:34:31 所属栏目:Windows 来源:网络整理
导读:a.html !-- a和b是同域的:http://localhost:3000 c是独立的:http://localhost:4000 a获取c的数据 a先引用c c把值放到window.name上,把a引用的地址改到b -- iframe src ="http://localhost:4000/c.html" frameborder ="0" onload ="load()" id ="iframe" /
a.html <!-- a和b是同域的:http://localhost:3000 c是独立的:http://localhost:4000 a获取c的数据 a先引用c c把值放到window.name上,把a引用的地址改到b --> <iframe src="http://localhost:4000/c.html" frameborder="0" onload="load()" id="iframe"></iframe> <script> let first = true function load() { if (first) { let iframe = document.getElementById(‘iframe‘) iframe.src = ‘http://localhost:3000/b.html‘ first = false } else { console.log(iframe.contentWindow.name) } } </script> b.html 空页面 c.html <script> window.name = ‘我不爱你‘ </script> ? 服务端 a.js let express = require(‘express‘) let app = express() app.use(express.static(__dirname)) app.listen(3000) b.js let express = require(‘express‘) let app = express() app.use(express.static(__dirname)) app.listen(4000) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows-server-2008 – Vertex 2 SSD一次冻结60秒
- windows-server-2008 – 如果Windows Server 2008无法启动,
- windows-server-2008-r2 – 我从raid上启动了哪个plex?
- windows-7 – 使用Powershell查询schtasks
- windows-server-2008 – 在Windows Server 2008 Core上安装
- 在Windows批处理文件中检查非零(错误)返回码的Foolproof方式
- 05、AGDLP组的嵌套
- windows下bat批处理实现数据库备份、压缩、删除
- windows-installer – Techsmith Snagit的Windows安装程序的
- 6.Tray Monitor服务(端监控服务)