Is there any difference between target="_blank"
and target=_blank
?
Seems to have the same behavior, but just want to make sure if one is better to practice than the other (and why). I have always used quotes, but am reading the rails tutorial and realized Michael does not use them.
The target=”_blank” link attribute is risky and opens a website to security and performance issues. Google's Web. dev page on the risks of using the _blank link attribute is summarized as such: “The other page may run on the same process as your page.
A target attribute with the value of “_blank” opens the linked document in a new window or tab. A target attribute with the value of “_self” opens the linked document in the same frame as it was clicked (this is the default and usually does not need to be specified).
In short, use target="_blank" it always open a new window but use target="blank" it will open a new window at the first time and this window will be reused after the first. Save this answer.
_blank: It opens the link in a new window. _self: It opens the linked document in the same frame. it is the default value. _parent: It opens the linked document in the parent frameset.
They are equivalent.
The HTML attribute syntax allows for quoted and unquoted attributes.
In addition to the general requirements for attribute values, an unquoted attribute value has the following restrictions:
- must not contain any literal space characters
- must not contain any """, "'", "=", ">", "<", or "`", characters
- must not be the empty string
Always use first approach. When you define an attribute, surround it's value with double quotes. While both can work, second seems to be messy and inconsistent as well as can lead to some issues with older browsers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With