
代码在页面 a ,b...
a 拥有正确的 div id
因此 js 取到页面 a 的 id 后进行判断后续它所在的所有页面,来隐藏相关内容。
1 Marthemis 2022-11-14 14:54:12 +08:00 本质还是各页面之间的通信问题,试试 Window.postMessage |
2 mxT52CRuqR6o5 2022-11-14 14:55:51 +08:00 同源才能直接做到,非同源需要 postMessage ,目标页面自身实现监听 message 消息 |
3 shaozelin030405 2022-11-14 14:57:04 +08:00 h5 postmessage 看看 |
4 AV1 2022-11-14 15:05:09 +08:00 以下的方式只在同源页面下有效 // 在旧页面使用新页面的 id const newWin = window.open('新页面的地址'); newWin.document.getElementById('新页面的元素的 id'); // 或者在新页面使用上一个页面的 id window.opener.document.getElementById('前一个页面的元素 id'); |
5 FoxElf 2022-11-14 15:12:28 +08:00 一定是需求错了 |
11 mozhizhu 2022-11-14 16:15:21 +08:00 古早的 Ajax 加载下一页…… |