473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,387 developers and data experts.

JavaScript communication between browser windows and tabs.

Nice few weeks ago I have decided to properly break same domain core communication problems between browser windows.

Example situation, having many pages opened with same domain name, in fact, it's very easy to use the idea for even totally different domain names. How? I'll write another document about it - but it IS simple.


The entire idea is based on a way that local network works, before explaining how it works, there is need to explain current techniques and theirs problems (we are not talking here about popups and its parents).


In general there are 4 ways of communication between browser windows:
  1. using window object (name property as far as I remember), this is very unsecure way, you cause other pages to be able to read that property, its also not working well for different instances. In my opinion should never be used for communication purpose.
  2. manipulating embeded frames in conjunction with domain property change and using same name of frame/popup - this is the way you access external embeded iframe knowing it exists and trying to open popup with that name will return reference to the iframe. This method doesnt work for all browsers and is very messy (probably you will always have initial moments of some crazy control popup appearing). The good thing about it is: direct access to your remote objects - you access them directly via frame, so thats a nice thing. There are also few other small problems with this solution (domain name limits, necessary extra files on server side etc. ... it is just a pain).
  3. Would be wonderful if new specifications for "postMessage" like methods was supported by all browsers, unfortunately - it doesnt and domain name limitations differs across browsers types (a bit annoying). Combining 2+3 would with pain construct solution for all browsers - but warning is: this will be a PAIN and remember that postMessage methods behave like network based communication.
  4. Cookies - old, supported by any browsers stuff. Cookies were used only for short messages (practically cookie max length is 4KB, some browsers handle more ... but most popular worst browsers does 4KB, so this is why it's "practically".
    Cookies limitations for size in my opinion is the only problem, seems that other problems with it was implementation.

I used to face all of these issues and one evening I have properly got annoyed with current solutions state and I have written code that using cookies only allows to exchange communication with any browser window/frame/page instance.

Solution is simple, the difficulty was implementation.
I have emulated network messaging packets flow similar way as BNC networks work, as a packet I have used: COOKIE.
The cool thing about implementation is that one can easily change from cookie to something else shared and use it with BNCConnector (I named it from BNC networks model).

To test the lib simply check out:

http://theprivateland.com/bncconnector
http://theprivateland.com/bncconnector/docs.htm

There is some more details , I thing that docs page will be best as showing example of usage - simpler=better.
The connector will work on any browser version that uses javascript and cookies, including mobile devices etc.

The solution can be easy enchanced to enable communication even across different domains :-) Give me a shout if its worth adding it.
Jun 9 '11 #1
0 21235

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: lee-dont | last post by:
I have a user who is entering information on a form and then submits it. The script replies with some data back to the original browser window, but I also want the script to open a new browser...
1
by: Mr. Clean | last post by:
Can I to get a list of all open browser windows using Javascript ? Let's say: my html opens 4 new windows (using the function open), is there a way to get an array windows or documents or...
5
by: wylbur37 | last post by:
How do you find out what version of JavaScript your browser supports? Is there a JavaScript function that will tell you? __________________________________ Do you Yahoo!? Find out what made...
3
by: ewosch | last post by:
Hi, is there a possibility to get the number or the names of open Browser windows ? I want to try to avoid double-opening of a page. My idea was to give the page a name and to check whether this...
0
by: Ayoa | last post by:
In my ASP.net project, I have a group of URLs (stored in a C# arraylist). I will like to send all of these URLs to new browser windows at the SINGLE click of a button. I know that clientside...
6
by: Paolo | last post by:
Hallo, i have found more script for autoresize a popup browser windows to the image opened but I search something that autoresize the browser windows popup to che content(for example a table with...
69
by: Peter Olcott | last post by:
Does JavaScript represent its controls internally as Microsoft Windows controls, or does it build them from scratch like Java?
1
by: dnes | last post by:
Open Multiple New Browser Windows from ASP.NET I'm having trouble figuring out how to open multiple new browser windows (each one displaying something different). As you can see from the code...
8
by: wpelgrum | last post by:
When I open a webpage with javascript my browser (both IE6 and FF2.0.0.3) freezes anywhere from seconds to more than a minute. During that period, the browser is frozen and windows (XP-SP2) is very...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.