Reputation: 509
How do I use javascript to redirect the current page and also open another popup window! would that be possible? is there a risk? thank you
Update:
I am trying now to:
var myid= "<xsl:value-of select="@ID" />"
which works for
document.location.href = http://... + myid
but won't work for
window.open=("http://... "+ myid)
Any idea what I am doing wrong. the is no value with windo.open
Upvotes: 0
Views: 214
Reputation: 2354
window.open("http://stackoverflow.com/")
window.location = "http://stackoverflow.com/"
Note: order is important here.
Upvotes: 2
Reputation: 38077
Use can use window.open to open a new window:
window.open("http://www.example.com");
You can update the document's location to do a simple redirect:
document.location = "http://www.example.com";
The draw backs of doing this is that additional windows tend to annoy users if they are not expecting it and some browsers/pop-up blockers will simply not allow the new window to open.
Upvotes: 1
Reputation: 32532
You can make javascript load a new page by changing the value of location.href
You can make javascript open a new popup window by using window.open()
FYI many browsers and addons will either prompt a visitor to allow/deny the popup, or flat out deny it.
Upvotes: 1
Reputation: 18848
Redirect:
window.location.href = "http://someothersite.com";
Popup:
window.open("http://somepopup.com","newWindowNameHere");
There are various features you can specify on your new window. See this reference.
Upvotes: 1