468,117 Members | 1,494 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,117 developers. It's quick & easy.

window.open() Question?

NC
Hi All,

We have an issue where if we say:

window.open(uri, 'QuickTradePopup',
'width=730,height=300,menubar=no,toolbar=no,scroll bars=yes,resizable=yes').


already existing window with name as 'QuickTradePopup' is not getting
overrided with new one.Ideally if we give a same window name it should
get overrided with existing window which has same name.This issue is
happening intermittently.

Please respond.

Regards,
N.C

Jun 1 '06 #1
4 1488

"NC" <su***************@gmail.com> wrote in message
news:11*********************@j55g2000cwa.googlegro ups.com...
Hi All,

We have an issue where if we say:

window.open(uri, 'QuickTradePopup',
'width=730,height=300,menubar=no,toolbar=no,scroll bars=yes,resizable=yes').


already existing window with name as 'QuickTradePopup' is not getting
overrided with new one.Ideally if we give a same window name it should
get overrided with existing window which has same name.This issue is
happening intermittently.

Please respond.


Sounds like a job for SmartPop. This will manage references to windows
that it opens, and pre-close any that you try to re-open.
Refer to the example usage.

<SCRIPT type='text/javascript'>
//S Chalmers 2006

SmartPop=
{
winData: {ref:[], title:[] },

up:function(locn, wName, paramString)
{
for(var i=0; i<this.winData.ref.length && this.winData.title[i]!=wName ;
i++)
;

if( i!=this.winData.ref.length && this.winData.ref[i].closed==false )
this.winData.ref[i].close();

if(locn != "")
{
this.winData.ref[i]=window.open(locn, wName, paramString);
this.winData.title[i]=wName;
}

return false;
}
}

</SCRIPT>

<A HREF='/' onclick='return
SmartPop.up("http://google.com","Google","width=200,height=200,top=200 ,left=200")'>Google
200x200</A><BR>
<A HREF='/' onclick='return
SmartPop.up("http://google.com","Google","width=300,height=300,top=200 ,left=200")'>Google
300x300</A><BR>
<A HREF='/' onclick='return
SmartPop.up("http://google.com","Google","width=400,height=400,top=200 ,left=200")'>Google
400x400</A><BR>
<A HREF='/' onclick='return SmartPop.up("","Google")'>Close Google</A><BR>
Jun 1 '06 #2
Stephen Chalmers said the following on 6/1/2006 7:46 PM:
"NC" <su***************@gmail.com> wrote in message
news:11*********************@j55g2000cwa.googlegro ups.com...
Hi All,

We have an issue where if we say:

window.open(uri, 'QuickTradePopup',
'width=730,height=300,menubar=no,toolbar=no,scroll bars=yes,resizable=yes').
already existing window with name as 'QuickTradePopup' is not getting
overrided with new one.Ideally if we give a same window name it should
get overrided with existing window which has same name.This issue is
happening intermittently.

Please respond.


Sounds like a job for SmartPop. This will manage references to windows
that it opens, and pre-close any that you try to re-open.
Refer to the example usage.


<snip>

Have you tested that code with Symantec's popup blocking?

Insert this at the beginning of your script block, then test it:

var SymRealWinOpen = window.open;
function SymWinOpen(url, name, attributes)
{
return (new Object());
}
window.open = SymWinOpen

It makes it pretty tough to try to circumvent. You could test for the
existence of SymRealWinOpen or SymWinOpen but as soon as the spammers
discover that trick it will be fixed again so that it isn't so simple to
detect Nortons popup blocker.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 2 '06 #3
Randy Webb wrote:
Have you tested that code with Symantec's popup blocking?
You mean the code they've withdrawn:
url:http://www.zdnet.com.au/news/securit...9234250,00.htm
Insert this at the beginning of your script block, then test it:

var SymRealWinOpen = window.open;
function SymWinOpen(url, name, attributes)
{
return (new Object());
}
window.open = SymWinOpen
I don't see the point you're making. My routine is intended to manage
the repeated opening of requested windows, which in practice will not
be blocked by the user. It has nothing to do with trying to circumvent
any level of popup blocking.
It makes it pretty tough to try to circumvent. You could test for the
existence of SymRealWinOpen or SymWinOpen but as soon as the spammers
discover that trick it will be fixed again so that it isn't so simple to
detect Nortons popup blocker.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Jun 2 '06 #4
Stephen Chalmers said the following on 6/2/2006 8:13 AM:
Randy Webb wrote:
Have you tested that code with Symantec's popup blocking?


You mean the code they've withdrawn:
url:http://www.zdnet.com.au/news/securit...9234250,00.htm


Actually, it is pleasing to know that but the article doesn't address
the popup blocker itself. It had flaws but that wasn't why it was
withdrawn <shrug>
Insert this at the beginning of your script block, then test it:

var SymRealWinOpen = window.open;
function SymWinOpen(url, name, attributes)
{
return (new Object());
}
window.open = SymWinOpen


I don't see the point you're making.


No other point than the futility of attempting to open new windows and
nothing more.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 2 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Michael | last post: by
4 posts views Thread by Jamie Jackson | last post: by
6 posts views Thread by Les | last post: by
12 posts views Thread by HarveyB | last post: by
32 posts views Thread by Eli | last post: by
2 posts views Thread by cschang | last post: by
8 posts views Thread by Dominic Tocci | last post: by
7 posts views Thread by Dr J R Stockton | last post: by
13 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.