index.html
1021 Bytes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>B页面</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<a href="javascript:;" class="btn">跳转</a>
<a href="javascript:;" class="btn1">发送消息</a>
<iframe src="http://127.0.0.1:3010/a.html"></iframe>
<script src="base.js"></script>
<script type="text/javascript">
(function(){
var _source = getQuery('source');
$(document).on('click', '.btn', function(){
window.location.href = "http://127.0.0.1:3010/a.html?source=" + _source;
});
$(document).on('click', '.btn1', function(){
window.opener.postMessage({
"status": 200,
"data": {
"source": window.location.href
}
}, _source);
});
})()
</script>
</body>
</html>