What the Difference between Attribute href and target | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What the Difference between Attribute href and target

14th Dec 2017, 5:01 PM
Nema Yousif
Nema Yousif - avatar
8 Answers
+ 5
Take a look at an example here: <a href="http://www.sololearn.com" target="_blank">Click me!</a> When you click it - it will open the "href" page in the "target" window. In this case in the new browser window.
14th Dec 2017, 5:32 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 5
It will then open in the same window, by default (unless you set your browser otherwise).
14th Dec 2017, 5:38 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
href is where you put the link to target is whether you want to open it in a new browser window/tab or not
14th Dec 2017, 5:12 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
aha;ok get it ; thank you
14th Dec 2017, 5:41 PM
Nema Yousif
Nema Yousif - avatar
0
and that's will not happen in href??
14th Dec 2017, 5:29 PM
Nema Yousif
Nema Yousif - avatar
0
Iunderstand that but if ididn't added target what will be hppening
14th Dec 2017, 5:36 PM
Nema Yousif
Nema Yousif - avatar
0
what happens when you don't add the target attribute, is that it opens in the same page. but it also depends on your browser settings. if you choose "open page in new window" then the default will be just that.
14th Dec 2017, 6:01 PM
storm
storm - avatar
0
ok ;get it ;that's mean depend on your browser setting without target
14th Dec 2017, 6:05 PM
Nema Yousif
Nema Yousif - avatar