View Full Version : Simple Question : window.location target??

08-24-2008, 12:59 PM
Hey there,

I'm using a very simple redirect for printing a printer-friendly version of some information.

I use a frame so that the page is hidden from the user.

The redirect I am using is :

<body onload="window.location='example.htm'">

This works great for me as I don't need any extra JS, just this quick, simple solution.

My question is, how can I add a target="_top" to the redirect to break out of the frames?

Thanks a lot!:thumbsup:

08-24-2008, 01:34 PM
You may have to use window.open() (http://www.w3schools.com/HTMLDOM/met_win_open.asp) (though I'm not sure about the purpose)

08-24-2008, 02:26 PM
Oh, try to use top.location=...

08-25-2008, 08:52 AM
Thanks liorean!

That works like a charm.

10-13-2008, 12:11 AM
window.open will open in new window... what if the browser is set to block the popup... whereas hyperlinks target=_blank works fine and why not a javascript code other than window.open...??? or we have to trigger a hyperlink event on an hyperlink which is set open in new window.... phew...