使用频率多:百度之间传数据也会使用
前端
a.html
<!-- 实现需要满足条件:域名 一级域名二级域名 www.baidu.com video.baidu.com a是通过 http://b.test.com:3000/a.html 访问 --> Hello, A <iframe src="http://b.test.com:3000/b.html" id="frame"></iframe> <script> document.domain = ‘test.com‘ function load() { console.log(frame.contentWindow.a) } </script>
b.html
<script> document.domain = ‘test.com‘ var a = 100 </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)
原文地址:https://www.cnblogs.com/zouxinping/p/10348826.html
时间: 2024-10-13 13:33:13