[thelist] Weird window targetting problem with javascript links

Roger Ly RLy at homestead-inc.com
Wed Jan 15 13:51:14 CST 2003


--
[ Picked text/plain from multipart/alternative ]
Has anyone come across a problem like this before:

I have a page with a link that calls window.open() in the onclick
handler to open a new window with a specified URL to a named window.
When I click on the link the first time, a new window pops up, as
expected.  When I click on it again, another window pops up, despite the
fact that I am trying to target that first window.

The funny thing is that when you go to any of those new browser windows,
and type "javascript:alert(window.name);" in the browser's URL bar, it
shows a popup stating that the window's name is as it should be
expected.  Furthermore, once you do that, any time you click on the
original link, it will then correctly target the link to that window for
whose name you just queried.  Also, if you have multiple windows opened
already, due to the fact that you clicked on that link several times,
they will all report the correct window name when queried, and the last
window whose name you queried will become the new target for the
original link.

The URL I am hitting is a PayPal buy button link, so I can't really tell
what is happening on PayPal's side.  Is it possible that there is some
kind of JavaScript that is being run on the client side which
invalidates the window.name of the window that popped up?  It seems
unlikely (and it isn't even doing it completely, since querying the
window gives me the correct name).

My <a> tag is formatted basically like this:
<a href="something.html" target="MyWindow"
onclick="window.open('something.html','MyWindow');return false">blah</a>
I have removed the third parameters of window.open for clarity's sake,
but I did intend to open up the window sized a certain way, etc.

You can see the problem in action at
http://members.evolt.org/rogerly/buy.html (its just a page with an <a>
tag, so no comments on the missing <html></html> etc.).  I know it
happens for me on Win2K and IE 6.0.  I haven't gotten a chance to test
it in many other places yet.

Roger Ly
Homestead Technologies, Inc.
650.549.3126
rly at homestead-inc.com


Homestead: Your Web Site Company





More information about the thelist mailing list