how do i get a link to open in a...

User 100264 Photo


Registered User
1 post

I need to know how to open a link in a new window while keeping the original page open. Anyone have the tags?
User 126492 Photo


Ambassador
1,525 posts

Spirallectik wrote:
I need to know how to open a link in a new window while keeping the original page open. Anyone have the tags?

Just add this into your link:-

target="_blank"

Your link would then look like this:-
<a href="http://www.site.com" target="_blank">Site</a>
Jim
---------------------------
User 148447 Photo


Ambassador
27 posts

From a usability viewpoint this is frowned upon except for pdfs docs etc that are not web pages. It is confusing for people to have lots of browser windows open.

Also be aware that the Google toolbar, as one example, prevents these types of windows opening so use this code with care and only when it neccessary.
User 243515 Photo


Registered User
508 posts

Geoffrey Kevin Joyce wrote:
From a usability viewpoint this is frowned upon except for pdfs docs etc that are not web pages. It is confusing for people to have lots of browser windows open.

Also be aware that the Google toolbar, as one example, prevents these types of windows opening so use this code with care and only when it neccessary.

That brings up the question then: "What's the alternative?"
User 12512 Photo


Ambassador
228 posts

Rhubarb wrote:
Geoffrey Kevin Joyce wrote:
From a usability viewpoint this is frowned upon except for pdfs docs etc that are not web pages. It is confusing for people to have lots of browser windows open.

Also be aware that the Google toolbar, as one example, prevents these types of windows opening so use this code with care and only when it neccessary.

That brings up the question then: "What's the alternative?"

There are Javascript solutions which will allow the page to validate to xhtml strict. Personally I hate js so I tend not to employ it.
User 95186 Photo


Ambassador
163 posts

Javascript altervatives would look something like this:

<a href="#" onclick="nojavascript...window.open('http://www.google.com','popwin','toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,height=200,width=200');">Click Here</a>

By setting the values (or merely excluding them from the code) for Toolbars, scrollbars, location, statusbar, menubar and resizable will allow you to let the users see these controls or not. The height and width attributes can be set to size the window itself. This is good for one link. If you need more try using a script that can be "recycled" as can be generated here:

http://javascript.internet.com/generato … indow.html

Cheers,

Simon.
User 2169755 Photo


Registered User
1 post

Geoffrey Kevin Joyce wrote:
From a usability viewpoint this is frowned upon except for pdfs docs etc that are not web pages. It is confusing for people to have lots of browser windows open.


I disagree, and I see this all the time. When referencing a page from another site, I find that it is fairly standard to open this in another tab or window.

User 148447 Photo


Ambassador
27 posts

Cliff is correct that it is fairly standard to open up other windows when linking to a differnt site. The practice of doing so does present issues for people who are, for example, partially sighted or have a learning difficulty. I give the following as a reference from the UN - many more exist. You may also wish to view the site of Jacob Neilson, who is acknowledged as being one of the leading experts on accessibility.

WAI Definition (Checkpoint 10.1)
Do not generate pop-ups or new windows and do not change the current window without informing the user.
Explanation
Do not create pop-ups (windows that automatically open).

Do not open links in new windows without informing the users.

Rationale
Pop-ups can be very frustrating for users and many people find them annoying. Pop-ups can also erode a user's trust in a site as it affects their control over the navigation and interaction.

Furthermore, pop-ups are known to cause problems for screen-reader users because they change the focus without warning. This means that the screen reader begins reading the content of the new window, usually without warning the user that a new window has opened. If the new window displays content from another site, the user can become very disoriented and confused.

Pop-up windows used to display an error message in a form can cause problems too. The user has to read the content of the pop-up window, navigate back to the main page, and then find the relevant position on the form again before they can fix the error.


Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.