Encontrar el nombre de una ventana emergente en 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

preguntado el 28 de agosto de 12 a las 13:08

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. -

Are you trying to get find out the name variable of a previous call to window.open(name, url [, ...])? -

@line-o it's (url, name [, ...]) :PAG -

SendMessage() is not a built in function but a user defined method to send msgs using websocket. -

2 Respuestas

to just answer your question, it is the name propiedad la window objeto.

window.name

por ejemplo:

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

Respondido 28 ago 12, 13:08

Thank you very much for response .It helped me. - sasi krishna

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 );

¡Salud

respondido 26 nov., 15:14

Thanks for ur response.it helped me. - sasi krishna

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.