最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Finding name of a popup window in JavaScript - Stack Overflow

programmeradmin1浏览0评论

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

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

Share Improve this question edited Aug 28, 2012 at 12:13 Musa 97.7k17 gold badges122 silver badges143 bronze badges asked Aug 28, 2012 at 12:07 sasi krishnasasi krishna 874 silver badges10 bronze badges 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 acplish because there might also be a better alternative. – senfo 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 [, ...])? – line-o Commented Aug 28, 2012 at 12:22
  • @line-o it's (url, name [, ...]) :P – jbabey Commented Aug 28, 2012 at 12:36
  • SendMessage() is not a built in function but a user defined method to send msgs using websocket. – sasi krishna Commented Aug 28, 2012 at 12:39
Add a ment  | 

2 Answers 2

Reset to default 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>");

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

发布评论

评论列表(0)

  1. 暂无评论