OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Does BroadcastChannel work on the same page?

  • Thread starter Thread starter Gqqnbig
  • Start date Start date
G

Gqqnbig

Guest
My web page has

Code:
var bc = new BroadcastChannel('Consumer');

bc.onmessage = function(event) {
  alert("a");
}

bc.postMessage("hello");

It broadcasts a message, and the page is also required to receive the same message.

However it doesn't work. Did I miss anything?

<p>My web page has </p>

<pre><code>var bc = new BroadcastChannel('Consumer');

bc.onmessage = function(event) {
alert("a");
}

bc.postMessage("hello");
</code></pre>

<p>It broadcasts a message, and the page is also required to receive the same message.</p>

<p>However it doesn't work. Did I miss anything?</p>
 

Latest posts

Top