By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,420 Members | 1,160 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,420 IT Pros & Developers. It's quick & easy.

window.open() Question?

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a

"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

P: n/a
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

P: n/a
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

P: n/a
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.