CliffC
CliffC

Reputation: 933

window.href open new window?

when ever i use

window.location.href=//some url

it always open a new window, this only happens when the parent window is an dialog box. Any idea what i did wrong?

i tried using

window.open("http://asdf.com", "_self");

as suggested on this thread window.location.href opens another window but it is still not working

thanks

Upvotes: 1

Views: 3466

Answers (2)

chprpipr
chprpipr

Reputation: 2039

Stumbled upon this question and thought I would offer an alternative. If you run into trouble with popup blockers, you can use plain old HTML to launch a url in a new window/tab. You won't have as much control over that is displayed (scrollbars, toolbar, etc), but it works even if javascript is disabled and is 508 compliant:

<a href="http://www.google.com/" target="_blank">Open new window</a>

You can read more about the various target attributes here: https://developer.mozilla.org/en/HTML/Element/a

Upvotes: 3

Salil
Salil

Reputation: 47532

Parent window

window.open("http://asdf.com", "window_name","location=1,status=1,scrollbars=1,resizable=no,width=650,height=650");

code in a parent window to open new

window.open('http://www.google.com', 'window_name', '_self')

Upvotes: 2

Related Questions