473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

window.open, target=_blank opens two windows

The code:
<a href="/art/visit/openhouse03/images/17.jpg" target="_blank"
onclick="popCenter(this.href,'name','500','500','n o'); return false;">
<img src="/art/visit/openhouse03/images/thumb17.jpg"></a>

The problem:
I always get two windows. I have the required "return false". I found a
post (http://tinyurl.com/avjlh) that addresses my exact problem, but
they told the guy he wasn't returning false properly. That doesn't make
any sense.

I could hack it by targeting the same window that JS opens, but then
I'm loading the page twice.

I just want it call my function if the user has JS, and open a blank
window if they don't.

Thanks.

--Don D.
(not the same Don as in the link given above)

Aug 3 '05 #1
9 38992
DonD wrote:
The code:
<a href="/art/visit/openhouse03/images/17.jpg" target="_blank"
onclick="popCenter(this.href,'name','500','500','n o'); return false;">
<img src="/art/visit/openhouse03/images/thumb17.jpg"></a>

The problem:
I always get two windows. I have the required "return false". I found a
post (http://tinyurl.com/avjlh) that addresses my exact problem, but
they told the guy he wasn't returning false properly. That doesn't make
any sense.

I could hack it by targeting the same window that JS opens, but then
I'm loading the page twice.

I just want it call my function if the user has JS, and open a blank
window if they don't.


I suspect something funny is happening in your popCenter() script. Try
the following:

<script type="text/javascript">
function popCenter( url, n, a, b, c ){
aWin = window.open( url, n, '');
}
</script>

<a href="a.gif" target="_blank" onclick="
popCenter(this.href,'name','500','500','no'); return false;
"><img src="a.gif"></a>
I can only test in IE with JavaScript on, but it worked fine in Firefox
with scripting on or off.

--
Rob
Aug 3 '05 #2
in article 11*********************@g44g2000cwa.googlegroups.c om, DonD at
Do**********@gmail.com wrote on 8/2/05 5:58 PM:
The code:
<a href="/art/visit/openhouse03/images/17.jpg" target="_blank"
onclick="popCenter(this.href,'name','500','500','n o'); return false;">
<img src="/art/visit/openhouse03/images/thumb17.jpg"></a>

The problem:
I always get two windows. I have the required "return false". I found a
post (http://tinyurl.com/avjlh) that addresses my exact problem, but
they told the guy he wasn't returning false properly. That doesn't make
any sense.

I could hack it by targeting the same window that JS opens, but then
I'm loading the page twice.

I just want it call my function if the user has JS, and open a blank
window if they don't.

Thanks.

--Don D.
(not the same Don as in the link given above)

Don, get rid of the target="_blank" that is not needed. The javascript
function is separate of the html function target and that is why you are
seeing that happening.

Aug 3 '05 #3
Phat G5(G3),

I'm not sure I understand. If the user has JS turned off, I still want
them to get a new window. I don't want the larger image to load in the
same window. If the user does have JS, then they get my window with the
proper sizing, etc. I can't give non-JS users a new window without
target=_blank, can I? I don't know a way.

--Don D.

Aug 3 '05 #4
??
Then why dun u just leave the JS and use HTML on its own.
mo
"DonD" <Do**********@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Phat G5(G3),

I'm not sure I understand. If the user has JS turned off, I still want
them to get a new window. I don't want the larger image to load in the
same window. If the user does have JS, then they get my window with the
proper sizing, etc. I can't give non-JS users a new window without
target=_blank, can I? I don't know a way.

--Don D.

Aug 3 '05 #5
?? wrote:
Then why dun u just leave the JS and use HTML on its own.

Because you can customize the popup in javascript in a way that you
cannot in html. Doing it this way means it will "gracefully degrade" if
javascript is turned off, but that you will get all the benefits if it
is on.

Kevin N.

Aug 3 '05 #6
RobG,

You're exactly right. I was calling another function within popCenter
and it was opening the additional window. I was digging in the wrong
place. Thanks!

--Don D.

Aug 3 '05 #7
in article 11**********************@g43g2000cwa.googlegroups. com, DonD at
Do**********@gmail.com wrote on 8/3/05 4:43 AM:
Phat G5(G3),

I'm not sure I understand. If the user has JS turned off, I still want
them to get a new window. I don't want the larger image to load in the
same window. If the user does have JS, then they get my window with the
proper sizing, etc. I can't give non-JS users a new window without
target=_blank, can I? I don't know a way.

--Don D.

No, you cannot. Its one way or the other. The only thing I can think of is
to write a function that will loop thru all windows looking for one with
your url and if not found then pop a new one. It'd take some work but
doable.

-Steffan

Aug 4 '05 #8
in article 42********@127.0.0.1, ?? at m@m.com wrote on 8/3/05 6:47 AM:
Then why dun u just leave the JS and use HTML on its own.
mo
"DonD" <Do**********@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Phat G5(G3),

I'm not sure I understand. If the user has JS turned off, I still want
them to get a new window. I don't want the larger image to load in the
same window. If the user does have JS, then they get my window with the
proper sizing, etc. I can't give non-JS users a new window without
target=_blank, can I? I don't know a way.

--Don D.


Earlier in this thread he is using a JS function to pop the window centered
and sized.

Aug 4 '05 #9
target="_blank"

popCenter(this.href,'name',

Try lmaking the target have the same characters,
like:

target="name"
Joe

"RobG" <rg***@iinet.net.auau> wrote in message
news:mg****************@news.optus.net.au...
DonD wrote:
The code:
<a href="/art/visit/openhouse03/images/17.jpg" target="_blank"
onclick="popCenter(this.href,'name','500','500','n o'); return false;">
<img src="/art/visit/openhouse03/images/thumb17.jpg"></a>

The problem:
I always get two windows. I have the required "return false". I found a
post (http://tinyurl.com/avjlh) that addresses my exact problem, but
they told the guy he wasn't returning false properly. That doesn't make
any sense.

I could hack it by targeting the same window that JS opens, but then
I'm loading the page twice.

I just want it call my function if the user has JS, and open a blank
window if they don't.


I suspect something funny is happening in your popCenter() script. Try
the following:

<script type="text/javascript">
function popCenter( url, n, a, b, c ){
aWin = window.open( url, n, '');
}
</script>

<a href="a.gif" target="_blank" onclick="
popCenter(this.href,'name','500','500','no'); return false;
"><img src="a.gif"></a>
I can only test in IE with JavaScript on, but it worked fine in Firefox
with scripting on or off.

--
Rob

Nov 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: gopal srinivasan | last post by:
I need to know how to close a parent modal window when child modal window opens, also i need to know the syntax for writing document on the modal window on the fly, like what we do in case of...
2
by: Laura | last post by:
I just need to install the DB2 client in a solaris machine. The machine has not installed an open windows environment so the installation should be done in character mode. Is it posible? How could...
1
by: Robert Misiak | last post by:
Is it possible (using either managed or unmanaged code) to get an array of an application's currently open windows? Thanks, Robert
2
by: M O J O | last post by:
Hi, I need to to get the caption of all open windows. Not only for my application, but for all running programs. I know it has something to do with Win32 EnumWindows, but I've tried some...
0
by: quinalnking | last post by:
Hello All, I am working on a project in VB 2005 and would want to have a list of open windows on a remote computer on my LAN. Can anyone guide me to it? I tried making a standalone app and...
6
by: awebguynow | last post by:
I'm writing a pretty complex webapp, that ideally will have 2-3 popup windows, but I am losing my session information when I open a new window. Is there a way to retain or replicate Session...
2
MrPickle
by: MrPickle | last post by:
I am trying to get all open windows on windows. I have looked around and seen that I should use EnumWindows and EnumWindowsProc so I whipped up this code to test it but it tells me there's 300-400...
1
by: alnino | last post by:
Hi, On a form I have a command button that allows a user to browse for a file (PDF, Word, etc…). This command button then stores a hyperlink to the file within an associated txtfield in the table....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.