When should you use target="_blank" on your links? - html

When are appropriate situations to use the target="_blank" attribute on your hyperlinks?
Edit:
To clarify, I know the syntax will open a new browser window. What I am asking is when is it appropriate to do so?

Whenever you want to annoy users.
More seriously, since this opens a new window/tab, it should be used sparingly, in my opinion.
Most modern browsers have some option (ie: middle-click on hyperlink) to do this for you, so I personally prefer allowing the user to handle this themselves.
However, if you are working on something where there is a non-technical reason for this, such as a sales-oriented site, it's often desirable to open a product brochure in a new window, or something along those lines. However, just be aware that overdoing this leads to my pseudo-joke response above....

When ever you want to leave the current page as-is.
I've got a feeling your question should be 'When is it appropriate to open a new tab or browser window?'
If so, the answer might be :
The current form may be in edit mode, and you want to be able to open
another page without either
disregarding or saving the current
one.
You have a data stream like Twitter which you want to leave active while
you go off and look at X.
There is a specific business requirement to do so.
Your users have weak navigation abilities and won't find their way back to the main page.

It is most appropriate when you're linking to outside resources that people may want to go to for additional information, reference, etc.
It lets them leave your site without losing their place on your page or have to use the back button.
It also makes sure they have to look at it one more time if they want to close it ;-)
(that last one is a joke and I don't advocate such despicable practices of course...)

Generally I avoid it like the plague. However, perhaps a good example of why you'd want to use that would be if you're building a cart module or something, and you have the "click for bigger picture" link. I think it's ok in that sense.
Keep in mind that whenever you do it, you're assuming you know the user's workflow better than they do (they can always open the link in a new window without you forcing it). In the case of the "bigger picture" link, you'd most likely be correct in assuming that's what they want, but in most cases I wouldn't jump to conclusions.

When you want the link to open in a new window, I would assume. I think the time to use this is when people might click on a link that'd destroy what they were doing on the page currently, such as a "help" link on a form.
Though some would argue that you should never use target="_blank".

One thing to be aware of here is accessibility. Built in features to help blind users (text to speech for example) may act weird (or just in a way that's confusing to the user) when you open a new window or tab.
Also, you're breaking the most used feature of every browser...the back button.

Only if it, with outmost certainty, prevents the user from having to repeat something.

I think that you should probably not ask a user experience question in a developer forum, because you will get developer answers.
That said, and as a developer, I open new Windows when I expect (or want) the user to come back and continue working on the site where the link originated.

The only time I would consider it is if you have multimedia on the page.
Best example I can think of - the StackOverflow podcast... I can't tell you how many times I've rushed to click a link in the blog post only to take me off the podcast page!
Also, on YouTube when I click "View Comments", it takes me away from the video page.
Whatever you do, don't use JavaScript to open a new window. That's definitely the worst. Nothing worse than a middle-click only to open a new tab with javascript::garbage in the address bar.

The target="_blank" is deprecated in XHTML 1.0 strict, and since I only write in strict I use JS if I really want to open a new page (or tab) and I only do that for external links (like a wiki or so).
More info:
http://www.ajaxblender.com/open-links-new-window-w3c-valid-target-blank.html
NOTE: Although it is deprecated in XHTML 1.0 strict, target="_blank" been brought back in HTML 5.

Stydying your audience will help you decide on this. Casual websurfers will appreciate target=_blank while tech-savvy people are more likely to get annoyed.

As for XHTML 1.0 strict, it is never appropriate. The target-attribute is deprecated in XHTML 1.0 strict.

Never. If I want to open your link in a new window I will do so.

When you open the link in a new window.

There exists practice to open in new window links that refer another/external domain (wiki for example).

I use it for product brochures and the like as I think it is useful for the customer to stay on the product page. I always indicate [new window] next to the link to keep the customer informed. Often the product brochure is a PDF, so I also note that the link will open a PDF.
Use it as you need it, but keep your users informed so as not to annoy/confuse them.

I prefer to avoid it, because most users can figure out on their own how to open a link in a new window, even if unsophisticated. My preference is to use an explicitly named destination, e.g. target="somename" if you have a good reason for opening a new window on your own.

I only use it when the client insists.
Otherwise I prefer to let the user decide.

I might be in the minority here but I like using target="_blank" for my links ONLY when they're meant to be reference links. In most cases, you shouldn't be using it for regular links around a website.
I really don't like it when I click on a link in a blog post or an article and it loads on the same page and I need to navigate back to the original source page.

When you are creating an email for mobile users and are linking to external content. That way, when they click on the link they will open the page in their browser.

When you want to open any particular link in new tab on current window then you can use target="_blank" in html.
<div class="restrunt-menu-list">
<ul>
<li>
<span>
<a target="_blank" href="www.example.com">View Menu</a></span>
</li>
</ul>
</div>
But It might affect your system performance because all browsers takes a lot of memory when it open a new tab or new window.
So less opened tab means less memory uses, less memory uses means better performance.
You can also see that which tab using how mach memory in chrome:
Press shift+Esc , Then you can see Task Manager- Chrome with list currently using memory by each tabs ( in chorme ).

For all external links...

Related

How to hide precious HTML from user eyes?

I am thinking to create an website that generates HTML through a wizard.Finally, I want to make the users to buy the generated HTML source if they like what they see.
But I don't want to let the users to steal the HTML, CSS and JS that I use to create the effect they want.
I want a technique which is immune to Firebug and Right Click -> View Page Source.
Any thoughts ?
edit: I remember something about iframes or frameset, but I'm not sure how to fool the browser and Firebug to execute the code without updating their capability of showing that source code. A popup is also a possible solution.
edit 2: html hosted in silverlight ? will you use it ?
The best thing you can do is to just obfuscate your code. Trying to hide the source is not going to work (for ex: if you disable right click-> view source that doesn't stop them from using the menu or saving the page or using a shortcut key or writing an app to stream the http request into a file and open that, etc).
Firstly, depending on what you are doing you can have the HTML code loaded through JS after the page load (AJAX).
As far as your JS goes:
Free Obfuscator
Not Free Obfuscator
In the end though, there is no stopping someone who really wants to get that source. Even obfuscated code can be rebuilt (though it's hell on wheels painful depending on how good the obfuscator is).
To really protect the sample HTML from prying eyes, you'd need to render it on the server-side and only pass image data to the client. If you want the user to be able to interact with the sample as if it were a normal Web page, you'll also need to send their pointer and keyboard inputs to the server and update the displayed image when necessary. At that point, though, you're basically making an HTTP-based version of VNC. This is definitely possible, but I don't think it will be easy, and I doubt there are any existing software packages to let you do this. If I were you, I'd rethink my business model a bit.
Sending XSL-templated XML to the browser may be enough fool some, and it will work more or less the same in many modern browsers including IE6 (maybe even 5.5).
But really, trying to hide the HTML code isn't going to work if anyone halfway serious wants to get it.
I am thinking to create an website that generates HTML through a wizard.
Finally, I want to make the users to buy the generated HTML source if they like what they see.
If this is what you need you might consider the possibility of creating a preview of the page as an image, and provide the download of the source only after the user agreed and paid. There is no magic way to let a browser display a code that you can't see.
You can make a video, showing the functionality and upload the same, which may help users to view / feel it.

need explanation about bookmarking

I got stumbled upon this issue once and I guess I need some expertise in getting through this .." some links that one likes to bookmark ." I tried browsing and got confused. is bookmarking just means the use of CTRL + D. Or is ti something like the one in this link .
"Bookmarking" comes from marking a page in a book with a bookmark, i.e. a piece of paper or something you put between pages to remember that page. In the same way you can mark web pages to return to them later. This usually just means saving the URL of the page in the browser.
So called social bookmarking is a technique where the URL is not saved in the user's local browser, but on a service such as del.icio.us, so others can see what you have bookmarked.
The basic idea is to remember a page you were on for later reference, that's all it means.
Bookmarking is storing the links somewhere. It can be a bookmark on your browser or even online something like StumbleUpen or Read It Later or even social bookmarking like sharethis.com
It can mean both, bookmarking generally means to add it to your favorites. Although, times they are a changing!
It is same as with "plain old bookmarks": You somehow keep a reference to a certain page. But instead using some physical indicator (what is obviously not possible with the computer ;)) you store the URL somewhere for fast access (in a way it is writing down the page number of a book).

Stop pop-ups with URL

I've been asked a question, and don't know if there is an answer.
"do you know if there is some code you can put into URLs to block pop-ups?"
This isn't using pop-up blocking software or toolbars etc, but a parameter in the URL. Almost opposite to the target="_blank" for instance.
Assuming I'm reading your question right, it sounds like you want to block people from being able to open links in new windows/tabs within your site? There is nothing native in HTML you can do to block this. But you could use some javascript to do it:
Link
Now, mind you, this really breaks the way the anchor tag is supposed to work and presents a number of problems. If someone has javascript disabled, they can't use any of your links. I'd assume it'll also present problems for search-engine spiders as I doubt they follow javascript logic like that.
I'd personally avoid implementing something like this though and hate any site that went out of it's way to prevent me from opening a link in a new tab.
You can't do it for pages that aren't yours unless you're using a popup blocker.
If you're talking about making sure your own site doesn't open links in a new window you can do something like this within the <head> and </head> tags:
<base target="_self" />
However, I'm pretty sure this is the default anyway and will not keep a link that manually has it's target="_blank" from opening in a new window so I doubt it'll do you any good.

Why are page titles on some websites clickable URLs?

Why on sites like Stack Overflow, Techcrunch, Smashing Magazine, etc. are the page titles (i.e. the text at the top of the page) clickable URLs that redirect to the same page that the user is on?
Some examples:
I believe that this does not effect SEO as search engines ignore internal links.
Is it for usability purposes?
It allows you to right-click on it and choose Copy link location (or equivalent) so that you can easily paste it in an email for example. This requires less time than copying it from the location bar, and some people run their browser without a visible location bar to save previous screen space.
More than anything, it provides a link to the default state of the page.
For example, for this very stack overflow page it is a user can get here through any of the following non-default links:
Why are Page Titles on some websites (including Stack Overflow) Clickable URLs?
https://stackoverflow.com/questions/904381#foobar
https://stackoverflow.com/questions/904381?sort=date
While the default link is actually:
Why are Page Titles on some websites (including Stack Overflow) Clickable URLs?
If users are unable to get to the default state, they end up bookmarking or emailing the non-default link which propagates to new users and the problem just multiplies.
Clicking on the title link of the post will restore the default state and strip off any query parameters (?sort=date), named anchors (#foobar) and fix the story slug (/why-are-page-titles/...).
I use it to refresh the page (yes, I could press F5 too).
Yes Jakob Nielsen has stated that linking to yourself is a web design mistake (nr 10). And I agree.
More reading info here. (nr 10)
The URL redirects to the beginning of the page, in case you arrived on the page via a specific answer (all answers are also clickable URLs). This way, you get the URL of the question, not of an answer.
Not sure if this is why they did it, but I find it useful to siphon off tabs:
If I look at something briefly and think "I'd like to read this thoroughly in a minute but continue with what I was doing before", I can do this:
I can right click the link, click "open in a new tab" and then click "back" and continue nicely.
It's called a Permalink... The name implies what it is, a permanent link.
It's the same reason that each answer on SO has a link you can copy.
I think it inherits the behavior from CMS where each question is a node, which has 0<= answered question. Now think you go for a search on apache questions.
The result are displayed one after another.
In terms of CMS this is called a teaser. You get a full page with lots of questions where the question's title link to the full article(question + answers)
Its not a must, but you'll find it on most sites which uses a CMS.
As long as it does not harm anyone why would people be against it?
I prefer to have those links available as hitting refresh would reload all elements of the page instead of just following the direct link (to the same page) that uses cached elements.
Makes sense to me, I find it useful! I have a lot of tabs open so I just right click the link and go back.
To me this makes perfect sense, from a SEO view this is also good! It forces it to read the page because it's linked.
UX-wise clickable titles which don't bring the user anywhere may seem unusable though that leads us into the realm of Affordance Theory and whether or not the affordance is perceptible to users.
For example, clickable page titles may provide:
A simple method for bookmarking a page to the desktop from a browser window.
A context menu with additional choices allowing users to share a blog post or article.
A method for updating the location bar so it's pointing at the canonical URL of the page.
For the sites you mentioned, however, it seems more likely the page titles were turned into hyperlinks using absolute URLs so analytics tooling could pick up inbound link clicks – those sending the referer info – resulting in DCMA takedown notices when people copied work and didn't update the URLs.
You'd be surprised what people do when they're being incentivized to produce work contractually.

opening links in the same window or in a new (tab)

It has always been best practice to open links in the same window. Should that still be the rule now that most common browsers use tabs? Personally i prefer closing a tab/window over hitting the backbutton. What are your thoughts?
If you prefer closing a tab/window over hitting the back button, then by all means, click links with your middle mouse button. But please don't force your surfing preferences on others. Tabs don't change this principle in the slightest.
I think consistency is the most important thing to keep in mind. Browsers are beginning to provide ways to open links in multiple tabs regardless of the web site's design decisions, so maintaining similar functionality as other websites is probably the biggest concern.
You really want your site's core features to behave like the other sites your users visit, so they feel comfortable and don't waste time trying to figure out the differences.
That said, there are times when you should open a new window/tab vs. opening a link in the current window/tab. For example, if the two pages (the current one, and the linked page) really need to be viewed simultaneously).
Yes, it should be the same. A new tab is more or less a new window, it just happens to be held in the same parent container as the original tab.
Are we discussing links that leave your site? Our company benefits provider has a web site for administering our flexible spending acct. It opens 3 separate windows from the time I login until I reach the page to submit a claim. I have never been a fan of opening a new tab/window when navigating within a site.
Thoughts?
Some browsers actually open a new window when asked to open a new window (gasp), even if they support tabs. I usually have two or three different browser windows open, each with a number of tabs, grouped by task. If some site unexpectedly forces a new window on me, I now have to re-integrate it as a tab into one of my open windows if I want to keep my task grouping. This is a major annoyance.
If I want to open something in a new tab, I can do so myself, thank you very much. Don't try to think for the user. The only time I can accept/expect a new window is when the original site needs to stay open, for example because I'm entering text into a form but need to open a "more info" window (see StackOverflow Answer Help button).
I'm going to wear out my scroll wheel button by the amount of tabs I open. There's a great Firefox extension that allows you to close the current tab with a single keypress, and I've assigned to it, so it's very easy to close tabs quickly.
I think it is still in the realm of personal preference, but depending on what I am browsing I am finding more and more that I open links in new tabs. I do this a lot when I a reading a page with a lot of related links but I want to finish reading the main page first. That way when I am done I can go look at all those links rather than trying to go back using the back button.