ars aranea. the web, the way we make it. | |||
29 Communicating between browser windowsPosted: Dec 7, 2005, under DHTML. Updated: Nov 1, 2006. Add a comment!This is probably obvious once you sit down and think about it, but I’m going to describe it anyway. You can communicate between any number of browser windows, in real time, using cookies set from JavaScript. JavaScript is allowed to set and read cookies in the browser. Once a cookie is modified or created, it enters a common pool which is instantly accessible from any browser window.
Of course, there’s a security limitation in place: you can only access cookies which were set for the same domain as the currently loaded page. If you set the cookies from a page on the harddisk (domain Here are two very simple HTML documents which will attempt to demonstrate this feature. First we have
And then there’s
Open the two files in the browser in two separate windows. Place the windows side by side, and type something in the sender. You’ll see the message duplicated instantly in the receiver. That’s pretty much all there is to it. While the security limitation can seem a bit restrictive, there are still plenty of legitimate uses. Especially when combined with remote procedure call scripting (such as XMLHttpRequest aka AJAX).
| Important
Categories
Authoring
(1)Books (2)Cross platforms (2)DHTML (12)Graphical design (3)IT today (12)Morals&Politics (10)ODP (1)Random stuff (3)Romania (16)Security (7)SEO (2)Software (8)SQL (1)Standards (7)Technology (3)WordPress (4)[În română] (4)[This website] (2)Time-jump Syndication Need hosting?I've been a happy user of LunarPages since 2005. |
||
Copyright ©2005–2008 Zuavra | |||