Send Data Between Tabs and Windows! - Broadcast Channel API in JavaScript

Поделиться
HTML-код
  • Опубликовано: 14 июл 2019
  • The Broadcast Channel API in JavaScript allows you to send data (or messages) between different browsing contexts (i.e. Tabs, Windows, IFrames etc.)
    It's very easy to do and you can send almost anything such as Strings, Objects, Arrays and even Blobs. In this video, I'll show you how to use it.
    Support me on Patreon:
    / dcode - with enough funding I plan to develop a website of some sort with a new developer experience!
    For your reference, check this out:
    developer.mozilla.org/en-US/d...
    Follow me on Twitter @dcodeyt!
    If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!

Комментарии • 23

  • @mtfreytag
    @mtfreytag 3 года назад +4

    Thank you for showing multiple examples. All the sites I've seen just regurgitate the basic documentation that i can find on MDN.

  • @ahora1026
    @ahora1026 5 лет назад +1

    I always wondered about this. But I was too lazy to search this out. Thankfully I had turned on the bell of your channel.

  • @TomasMisura
    @TomasMisura 5 лет назад +2

    nice video tut, i have never heard about Broadcast channel API

  • @tct38
    @tct38 Год назад

    I found it very useful. Thanks

  • @genyklemberg
    @genyklemberg Год назад

    awesome. I even forgot about this possibility, thankfully your video was first on my request)

  • @asaintdonkey
    @asaintdonkey 2 месяца назад

    Thank you!

  • @domaincontroller
    @domaincontroller 3 года назад

    00:14 browser contexts, tab windows and s

  • @FetzenRndy
    @FetzenRndy 5 лет назад +1

    What font and theme are you using?

  • @namnam4732
    @namnam4732 2 года назад

    Hi Dcode, How to make server tells client js that some data have been changed.

  • @TV-ho9yi
    @TV-ho9yi 4 года назад

    115 like
    Useful channel

  • @shubhamarora547
    @shubhamarora547 5 лет назад +1

    Sir please make tutorial on how to print emoji in any coding language javascript , html,php using vscode editor extension.

    • @ahora1026
      @ahora1026 5 лет назад

      -_-

    • @cod9955
      @cod9955 4 года назад

      p

    • @brain-in
      @brain-in Год назад +1

      You can print (i think you meant console.log) in any code by using the following code in javascript
      var emoji = '\u{1F44D}'; //Replace the following unicode with your unicode like the following
      console.log(emoji);

    • @brain-in
      @brain-in Год назад

      Hope this help if you have any doubt about this you can ask me😄

  • @progm6127
    @progm6127 3 года назад

    is it possible to send a message from one Tab(youtube page) to other Tab(Facebook)

    • @dcode-software
      @dcode-software  3 года назад +2

      Nah, you can't do that

    • @progm6127
      @progm6127 3 года назад

      @@dcode-software is it possible by using an Extension?

    • @dcode-software
      @dcode-software  3 года назад +2

      Not sure, probably not cos it'd be a security issue

    • @progm6127
      @progm6127 3 года назад

      @@dcode-software ok ...thanks sir,

  • @DivijShrivastava
    @DivijShrivastava 4 года назад

    Is there a way to broadcast messages through different origin? I mean if the port and host are not the same of two tabs.

    • @spreadItWide
      @spreadItWide Год назад

      Short answer: No.
      From MDN: The BroadcastChannel interface represents a named channel that any browsing context of a given origin can subscribe to. It allows communication between different documents (in different windows, tabs, frames or s) of the same origin. Messages are broadcasted via a message event fired at all BroadcastChannel objects listening to the channel, except the object that sent the message.

  • @SerhiiNesterov
    @SerhiiNesterov Год назад

    Thank you !