Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-28-2012, 12:13 AM   PM User | #1
The Noob Coder
New Coder

 
Join Date: Jul 2012
Posts: 72
Thanks: 1
Thanked 0 Times in 0 Posts
The Noob Coder is an unknown quantity at this point
Question How do I get a link to open in a new window?

I'm trying to get a link to open in a new window, but so far the best I could do is get it to open in a new tab by setting target="_blank" in the <a> tag. How can I get a link to open in a new browser window and also specify the length and width of the new window?

Thanks in advance for any help.
The Noob Coder is offline   Reply With Quote
Old 09-28-2012, 12:39 AM   PM User | #2
aaronhockey_09
Regular Coder

 
Join Date: Dec 2010
Posts: 411
Thanks: 21
Thanked 55 Times in 55 Posts
aaronhockey_09 is an unknown quantity at this point
take a look at this.
Pretty sure you have to use javascript to make it open in a new window and not a new tab
http://www.htmlforums.com/client-sid...ab-137214.html

Cheers
aaronhockey_09 is offline   Reply With Quote
Old 09-28-2012, 03:08 AM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,447
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Even with JavaScript you can't guarantee where it will open. Also the size and location options you can specify for JavaScript are just suggestions that the browser can ignore.

The only way to be certain that a page will open in a new window is when you are the one opening it - you right click on the link and select "new Window".
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 09-28-2012, 04:39 AM   PM User | #4
transybao
New to the CF scene

 
Join Date: Sep 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
transybao is an unknown quantity at this point
you can use JavaScript to open a new window
transybao is offline   Reply With Quote
Old 09-28-2012, 11:46 PM   PM User | #5
The Noob Coder
New Coder

 
Join Date: Jul 2012
Posts: 72
Thanks: 1
Thanked 0 Times in 0 Posts
The Noob Coder is an unknown quantity at this point
Quote:
Originally Posted by felgall View Post
Even with JavaScript you can't guarantee where it will open. Also the size and location options you can specify for JavaScript are just suggestions that the browser can ignore.

The only way to be certain that a page will open in a new window is when you are the one opening it - you right click on the link and select "new Window".
While that may be true on the technical side, no user will want to manually open a new window.
The Noob Coder is offline   Reply With Quote
Old 09-28-2012, 11:51 PM   PM User | #6
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,579
Thanks: 5
Thanked 864 Times in 841 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Quote:
Originally Posted by The Noob Coder View Post
While that may be true on the technical side, no user will want to manually open a new window.
How do you know that?

In fact, target="_blank" was removed from the HTML 4 specification because the tenor was that people shouldn’t be forced a new window/tab but should be able to decide for themselves how they would open links. And I do know people who actually do this (you can also Shift-click a link to open a new window or Ctrl/Cmd-click to open a new tab).
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 09-29-2012, 12:06 AM   PM User | #7
The Noob Coder
New Coder

 
Join Date: Jul 2012
Posts: 72
Thanks: 1
Thanked 0 Times in 0 Posts
The Noob Coder is an unknown quantity at this point
Quote:
Originally Posted by VIPStephan View Post
How do you know that?
Good question. I guess I was just speaking for myself (and my boss). Personally, if a link says (or implies) that it will open in a new window, I don't want to have to do extra work to get it to do what it promises. But if that is not your view of it, no problem. We can agree to disagree.
The Noob Coder is offline   Reply With Quote
Old 09-29-2012, 12:16 AM   PM User | #8
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,579
Thanks: 5
Thanked 864 Times in 841 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Thing is that most links don’t say that they are opening in a new window. Take Wikipedia for example. External links have an icon but it only says that this link will lead away from Wikipedia, it doesn’t say it opens in a new window. And (luckily, in my opinion) it’s up to the user to decide. I wouldn’t want every external link to open in a new window/tab (but this time I can only speak for myself either).

I’m not saying that this couldn’t be useful at times but it’s not the norm for the average website.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 09-29-2012, 12:21 AM   PM User | #9
The Noob Coder
New Coder

 
Join Date: Jul 2012
Posts: 72
Thanks: 1
Thanked 0 Times in 0 Posts
The Noob Coder is an unknown quantity at this point
Quote:
Originally Posted by VIPStephan View Post
I’m not saying that this couldn’t be useful at times but it’s not the norm for the average website.
You're absolutely right about that. I am just using it for a specific application. In my online store (where we sell t shirts) I have a link in all the shirt descriptions that links to a sizing chart. It just made more sense to have this pop up because the user would just take a single quick glance to figure out what size they want and not look at it anymore.
The Noob Coder is offline   Reply With Quote
Reply

Bookmarks

Tags
link, new window, open

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:14 PM.


Advertisement
Log in to turn off these ads.