Sending/Receiving Message to Another URL or Tab in VUE

I’ve created a simple code example in VUE where I’m sending and receiving messages. The example of the code is on CodeSandbox: https://codesandbox.io/s/wc1mc and click Go To Board some random URL is generated eg.https://wc1mc.csb.app/board/100. I’m struggling with sending the message to another browser tab. My solution works in the same tab but not across the tabs. Now what I would like to do:

  1. Open this URL https://wc1mc.csb.app/board/100 in two browser tabs
  2. Open another URL eg. https://wc1mc.csb.app/board/50 in the third tab
  3. In the tab https://wc1mc.csb.app/board/100 click button Update
  4. Both tabs with ending 100 should show Received: 100 and the tab 50 should not be updated

I would like to use messages as in the future sender and receiver might be on a different domain. Thanks for your help.

76 thoughts on “Sending/Receiving Message to Another URL or Tab in VUE”

Leave a Comment