https://github.com/vitkarpov/tabs-channel
:bookmark_tabs: JavaScript library to make channels between browser tabs
https://github.com/vitkarpov/tabs-channel
Last synced: about 2 months ago
JSON representation
:bookmark_tabs: JavaScript library to make channels between browser tabs
- Host: GitHub
- URL: https://github.com/vitkarpov/tabs-channel
- Owner: vitkarpov
- Created: 2016-02-20T12:20:34.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-26T06:18:26.000Z (almost 7 years ago)
- Last Synced: 2024-10-30T01:29:22.220Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 22
- Watchers: 5
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tabs Channel
TabsChannel is a JavaScript library which provides a channel between different tabs (windows) for documents from different domains (dealing with security issues).
So, A.com and B.com are opened in different tabs and want to communication to each other.
A.com:
```js
var proxy = new TabsChannel({
id: 'should-be-the-same-for-different-tabs'
});proxy.send('hello from A!');
```B.com:
```js
var proxy = new TabsChannel({
id: 'should-be-the-same-for-different-tabs'
});proxy.onReceive = function(message) {
console.log(message);
};// prins "hello from A!" when A.com sends a message
```A.com sens messages to B.com and the one gets them and can handle. Channel works in both directions.
[**How it works**](https://medium.com/front-end-hacking/communication-between-tabs-43a35725edfe)