Solved

Always open target blank as new window not new tab

Posted on 2009-04-11
6
3,482 Views
Last Modified: 2012-05-06
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!
0
Comment
Question by:sabribo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:Phatzer
ID: 24123541
The only way I can see of doing it in a new window is to make an A tag as below:

The below method should work for browsers, which do not support javascript too.
<a href="mylink.html" onclick="window.open('mylink.html'); return false;" target="_blank">Link</a>

Open in new window

0
 

Author Comment

by:sabribo
ID: 24123601
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?
0
 
LVL 42

Expert Comment

by:David S.
ID: 24123670
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.
<a href="mylink.html" onclick="return !window.open(this.href,'','width=600,height=480');" target="_blank">Link</a>

Open in new window

0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 

Author Comment

by:sabribo
ID: 24123758
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!
0
 
LVL 42

Accepted Solution

by:
David S. earned 250 total points
ID: 24124057
Oh, right. Check this one out: http://videobox-lb.sourceforge.net/

It gives the same instruction about where to put the <script> elements, but I suggest you try putting them wherever you feel like it and see if it still works.
0
 

Author Closing Comment

by:sabribo
ID: 31569224
Cool - this works great. My first java script implementation and it was pretty easy to do... Thanks!
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question