Link to home
Start Free TrialLog in
Avatar of Bob Stone
Bob StoneFlag for United States of America

asked on

Firefox 2 problem with this.href _self link

I am trying to use link buttons like below, they work fine in IE, but are totally broken in Firefox 2

<input type="button" value="Name" a href="link.asp" onclick="window.open(this.href, '_self')" />

How do I fix that?

Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

stone5150,

If you are changing the URL of this window I would use document.location.href instead.  The "tag" you had doesn't look valid.  It looks like a typo or something since it has an anchor tag in it.  However in an anchor tags onclick event you could have ...

onclick="document.location.href=this.href; return false;"

Since you aren't really "opening" a window window open isn't really needed.  Let me know if you have any questions or need more information.

b0lsc0tt
Avatar of Bob Stone

ASKER

That doesn't work in FF2 either.

I get a 404 error and the address bar shows -> http://www.domain.com/undefined
ASKER CERTIFIED SOLUTION
Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cool =o)

That worked.
Great!  I'm glad that I could help.  Thank you for the grade, the points and the fun question.

bol
i believe it's an issue with your href not being constructed with relative rather than an absolute urls and not specifying the http://

<input type="button" value="Name" href="www.google.com" onclick="window.open(this.href, '_self')" /> does not work in FF2

<input type="button" value="Name" href="http://www.google.com" onclick="window.open(this.href, '_self')" /> Does Work in FF2


btw
<input type="button" value="Name" onclick="document.location.href='www.google.com'; return false" /> does not work in FF2
<input type="button" value="Name" onclick="document.location.href='http://www.google.com'; return false" /> Does Work in FF2