sasi krishna
sasi krishna

Reputation: 87

Finding name of a popup window in JavaScript

I am creating multiple popup windows for chatting. Now my problem is how to find uniquely from which SendMessage() is called from popup window for sending message to other person. At least how to find the name of pop window.

Please help me so that I can move forward

Upvotes: 2

Views: 8974

Answers (2)

Sundar G
Sundar G

Reputation: 1069

You can provide your name to the window like this

window.open(URL,name,specs,replace);
myWindow=window.open('','MsgWindow','width=200,height=100');
myWindow.document.write("This window's name is: " + myWindow.name );

Cheers

Upvotes: 2

M Abbas
M Abbas

Reputation: 6479

to just answer your question, it is the name property the window object.

window.name

Ex:

var myWindow = window.open('','someName','width=200,height=100');
myWindow.document.write("<p>This window's name is: " + myWindow.name + "</p>");

Upvotes: 5

Related Questions