Forum Moderators: open

Message Too Old, No Replies

'visited' links not working for popups in netscape

         

bryndyment

6:06 pm on Apr 27, 2003 (gmt 0)

10+ Year Member



Hi,

I have a link that opens a pop-up. In IE, when clicking on the link, it correctly sets the link color to "visited". However, I can't get this working in Netscape. Here are three attempts (all which work in IE, none of which work in Netscape):


<a href="javascript: void window.open( 'popup.htm', 'ignored', 'height=50, width=50' )">link 1</a>
<a href="javascript:void%20window.open('popup.htm','ignored','height=50,width=50')">link 2</a>
<a href="javascript:void" onclick="javascript: void window.open( 'popup.htm', 'ignored', 'height=50, width=50' )">link 3</a>


Ideas on how to make Netscape happy?

rainborick

7:58 pm on Apr 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I didn't actually see anything in your samples that I know Netscape won't accept, but

<a href="javascript:void();" onclick="javascript:window.open('popup.htm','','width=50,height=50');">pop me</a><br>

should do the trick. Older versions of Netscape wouldn't tolerate space characters in the pragma, though. Good luck!

bryndyment

8:08 pm on Apr 27, 2003 (gmt 0)

10+ Year Member



Just checked that snippet, and it exhibits the same behavior (correctly shows 'visited' status in IE, but not Netscape...).

I've been trying to track this problem down, but it's hard to come up with Google search terms that don't return a jillion results for this guy...

DrDoc

8:16 pm on Apr 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Which Netscape version are you talking about?

I know that some browsers ignore a "visited" state for JavaScript controlled links (because of the dynamic possibilities).

bryndyment

9:00 pm on Apr 27, 2003 (gmt 0)

10+ Year Member



6.22 on Windows 2000, and 7.02 on Windows XP.

The only reason I'm using window.open is to control the size of the popup... maybe I should try to use target="_top" and href="popup.htm", then have the window resize during load?

bryndyment

9:12 pm on Apr 27, 2003 (gmt 0)

10+ Year Member



Sorry, target="_new"...

DrDoc

9:15 pm on Apr 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It should actually be "_blank", not "_new" ;)

_self = current frame (same as _top on a non-frame site)
_parent = parent frame (same as _top on a non-frame site)
_top = clears all frames and opens the href in the window
_blank = opens the href in a new window

DrDoc

9:21 pm on Apr 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think you should do a combination of everything. That way the page will work even if JavaScript is turned off.

<a href="popup.htm" target="_blank" onclick="window.open('popup.htm','','width=50,height=50');return false;">link text</a>

Causes the page to open in a new window if JavaScript is turned off
Causes the JavaScript to be executed instead. return false will cancel the normal link behavior (i.e. you will not get two windows with the same page)

DrDoc

9:22 pm on Apr 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And, I actually think that will make it work in Netscape too ;)

...haven't tested it though, so it might not.

bryndyment

9:43 pm on Apr 27, 2003 (gmt 0)

10+ Year Member



Nice code, DrDoc, and, yes... it works* in Netscape, too, in terms of the "visited" behavior.

*almost... you have to do a page refresh to see the "visited" status of the link. Close enough for me.

Thanks.

bryndyment

2:34 am on Apr 29, 2003 (gmt 0)

10+ Year Member



Just testing that code on Macintosh, and notice that, unlike IE/Netscape on Windows, "window." is needed before "open()". Just wondering if this is a bug on Macintosh.

If, however, your onclick handler calls your own function ("myOpen()"), then it's fine to just have "open()" in THAT function. Just not directly in the onclick handler.

(Kinda minor.)