2

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

4
  • Could you please provide more details? The question is quite vague, in my opinion. I'm not even sure what SendMessage() is. ;-) Is it a built in function? Something you wrote? Maybe explain more about what you're hoping to accomplish because there might also be a better alternative. Commented Aug 28, 2012 at 12:10
  • Are you trying to get find out the name variable of a previous call to window.open(name, url [, ...])? Commented Aug 28, 2012 at 12:22
  • @line-o it's (url, name [, ...]) :P Commented Aug 28, 2012 at 12:36
  • SendMessage() is not a built in function but a user defined method to send msgs using websocket. Commented Aug 28, 2012 at 12:39

2 Answers 2

5

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>");
Sign up to request clarification or add additional context in comments.

Comments

2

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.