How can I have two tabs (or windows) that are on the same domain be able to talk to each other without having to have one window instance the other.
Edit: Why was this marked as duplicate when this was asked before the other question?
The main features of localStorage are: Shared between all tabs and windows from the same origin. The data does not expire. It remains after the browser restart and even OS reboot.
I found a way, I can make two flash movies on each page with LocalConnection to invoke JavaScript on the other page using externalinterface.
Put this in a AS3 swf, this is the receiver:
import flash.external.ExternalInterface;
import flash.net.LocalConnection;
var mLocalConnection:LocalConnection;
mLocalConnection = new LocalConnection();
mLocalConnection.connect("xivioview");
mLocalConnection.client=this;
function recieveText(textRecieved):void {
ExternalInterface.call(textRecieved);
};
And the sender swf:
import flash.external.ExternalInterface;
import flash.net.LocalConnection;
function sendtoview(con,val):String {
//create local connection for sending text
var sending_lc:LocalConnection;
sending_lc = new LocalConnection();
sending_lc.send("xivioview", "recieveText", val);
return "kk"
}
ExternalInterface.addCallback("sendtoview", sendtoview);
This is set up for one-way, and the javascript to use it:
document.getElementById("youembeddedobject").sendtoview("xivioview","alert('Hai!')")
That will execute that JavaScript code in the receiver's tab, but it won't execute until you go back to that tab (I already asked a question why, and have no response yet)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With