Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Detect popup window in IE6

Reply
Thread Tools

Detect popup window in IE6

 
 
lrlebron@gmail.com
Guest
Posts: n/a
 
      06-13-2007
I am using the following to detect if a popup window is already open.
I only want to open a new window if it does not exist or has been
closed.
<HTML>
<HEAD>
<script language="JavaScript" type="text/javascript">
<!--
var myPage;
function openMyPage() {
if (!myPage || myPage.closed){
myPage=window.open("default.aspx", "_blank");
}
else {
alert("NFSL1 is already opened");
}
}
//-->
</script>

</HEAD>
<BODY>
<FORM>
<INPUT TYPE="button" onClick="openMyPage();" VALUE="open MyPage">
</FORM>
</BODY>
</HTML>


The code works correctly in Firefox, but IE6 opens a new window every
time.

Any ideas?

thanks,

Luis

 
Reply With Quote
 
 
 
 
Janwillem Borleffs
Guest
Posts: n/a
 
      06-13-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> myPage=window.open("default.aspx", "_blank");
>


The second argument should be the name (myPage) not a target (_blank).


JW


 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      06-13-2007
Janwillem Borleffs said the following on 6/13/2007 4:48 PM:
> (E-Mail Removed) wrote:
>> myPage=window.open("default.aspx", "_blank");
>>

>
> The second argument should be the name (myPage) not a target (_blank).


And it should be opening a window with the name of "_blank" - which it
is - but IE <gasp> gets it right and opens a new blank window each time.

Solution: give it a different name other than _blank.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
Roger
Guest
Posts: n/a
 
      06-13-2007
Randy Webb wrote:
> Janwillem Borleffs said the following on 6/13/2007 4:48 PM:
>> (E-Mail Removed) wrote:
>>> myPage=window.open("default.aspx", "_blank");
>>>

>>
>> The second argument should be the name (myPage) not a target (_blank).

>
> And it should be opening a window with the name of "_blank" - which it
> is - but IE <gasp> gets it right and opens a new blank window each time.
>
> Solution: give it a different name other than _blank.
>


Also, if you give the window a name the first time it is opened, you do
not have to bother testing to see if the window is still open. Just
request another new window using the same name and any existing window
with the requested name will get reused.

Roger
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
determining javascript popup window dimensions in IE6 - onresize PradeepCBala@gmail.com Javascript 0 11-29-2007 05:32 PM
Popup window not working properly in IE6 Terren ASP General 6 09-28-2005 06:30 PM
Popup window will not close on IE6 XP_SP2 after postback Drew Berkemeyer ASP .Net 7 10-24-2004 11:20 AM
New Popup Window from an existing Popup Window Raffi Javascript 4 08-12-2004 01:21 PM
Main > Popup > Popup > Close popup AND new URL in main? Jens Peter Hansen Javascript 7 06-19-2004 08:56 PM



Advertisments