sabribo
asked on
Always open target blank as new window not new tab
I would like to link to several videos from the main pages of my website. I have the code set to open the new page (with the video) as target="blank" and then I use body onload to resize the new window to the size of the video. My goal is to have the main page visible in the background while someone watches the video. However, if someone's browser settings are set to always open a new tab (not new window), then a new tab opens and the whole browser gets resized instead of just the video window. Is there any better way to do this? I'm not very familiar with java script, so I'd like to keep the programming in html. Thanks!
ASKER
Hi Pahtzer,
I tried this but it doesn't seem to change anything. The page still opens in a new tab, not a new window. I tried it in Firefox. Any other ideas?
I tried this but it doesn't seem to change anything. The page still opens in a new tab, not a new window. I tried it in Firefox. Any other ideas?
I've heard that if you set dimensions for the new window it won't open in a tab.
Two things I'd like to add though.
1) It's more user friendly to use a script like Lightbox: http://www.huddletogether.com/projects/lightbox2/
2) It's best to avoid using event handler attributes when you can.
Two things I'd like to add though.
1) It's more user friendly to use a script like Lightbox: http://www.huddletogether.com/projects/lightbox2/
2) It's best to avoid using event handler attributes when you can.
<a href="mylink.html" onclick="return !window.open(this.href,'','width=600,height=480');" target="_blank">Link</a>
ASKER
Kravimir,
I do like the solution you suggest under 1. and it doesn't seem too complicated, although it is in js. However, I noticed at the bottom of the page that this script only applies to photos not videos. Is there a modification available that would apply to videos? Also, is there a way to modify the js, so that I don't have to put it in the header of the page but somewhere in the body code on respective pages? Thanks!
I do like the solution you suggest under 1. and it doesn't seem too complicated, although it is in js. However, I noticed at the bottom of the page that this script only applies to photos not videos. Is there a modification available that would apply to videos? Also, is there a way to modify the js, so that I don't have to put it in the header of the page but somewhere in the body code on respective pages? Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cool - this works great. My first java script implementation and it was pretty easy to do... Thanks!
The below method should work for browsers, which do not support javascript too.
Open in new window