CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   How do I get a link to open in a new window? (http://www.codingforums.com/showthread.php?t=274486)

The Noob Coder 09-28-2012 12:13 AM

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.

aaronhockey_09 09-28-2012 12:39 AM

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

felgall 09-28-2012 03:08 AM

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".

transybao 09-28-2012 04:39 AM

you can use JavaScript to open a new window :)

The Noob Coder 09-28-2012 11:46 PM

Quote:

Originally Posted by felgall (Post 1274283)
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.

VIPStephan 09-28-2012 11:51 PM

Quote:

Originally Posted by The Noob Coder (Post 1274631)
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).

The Noob Coder 09-29-2012 12:06 AM

Quote:

Originally Posted by VIPStephan (Post 1274632)
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. :thumbsup:

VIPStephan 09-29-2012 12:16 AM

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.

The Noob Coder 09-29-2012 12:21 AM

Quote:

Originally Posted by VIPStephan (Post 1274636)
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.


All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.