其他分享
首页 > 其他分享> > 跨窗口通信(Broadcast Channel)

跨窗口通信(Broadcast Channel)

作者:互联网

1. Broadcast Channel(只要是在同一原始域和用户代理下)

  1. 发送信息页面
const bc = new BroadcastChannel('kevin')
bc.postMessage('hhh')
  1. 接受信息页面
let clickChannel = new BroadcastChannel('click')
clickChannel .onmessage = (e) => {
  console.log('e :>> ', e)// 发送的数据
}

2.

标签:窗口,bc,clickChannel,Broadcast,BroadcastChannel,new,Channel
来源: https://blog.csdn.net/weixin_40624809/article/details/120216126