Question

I have been using something like so, <a href="myURL.php" target="blank">Some text</a>, for almost 3 years now and I want to make sure I am not doing something terribly illegal.

After looking up some info I started to notice everywhere stated it as target="_blank". This started to bring some concern to me that I may need to go back through all of the websites I have worked on and make changes to include _.

When I run it through the validator it does not cause an error and does not even inform me of a warning pertaining it.

My question:

  1. Is this against the guidlines to not use the, _, underscore?

  2. If this is against the guidelines then why does it not cause an error and why does it work?

As a side note, I couldn't find much info on this but I at least found the specs for links.

Was it helpful?

Solution 4

Strictly-speaking, what you're doing (not using the underscore) is incorrect.

If you opt to simply use target="blank" then your link will still open correctly but with a subtle difference: clicking on the link will reuse the window opened last time instead of opening a new one.

This is because the target attribute contains the name of the frame the link should open in. If a frame with the name 'blank' (as you're declaring) doesn't exist then it will open a new window and designate it with that name. So, whenever another link within your page that also contains target="blank" is clicked upon, it's the same window that was opened last time (assuming that it's still open) that will change.

Basically, there's no massive need for you to go back through your old websites changing everything you've done, but you should consider changing to target="_blank" going forward if what you intend is for it to open a new tab/window each time.

OTHER TIPS

_blank means "Open a new, unnamed window"

blank means "Use a window/tab/frame named 'blank'"

If you click on a second link with target="blank" then it will open in the same window as the first target="blank" link.

The target attribute can either be the name of a frame (which can be anything), or one of three special names that start with _.

target="blank" means open in window named "blank". If the window named "blank" already exists, it will open site in that window. May be a frame in document.

target="_blank" means open in new window.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top