The <a> (anchor) element creates a hyperlink. Its href is the destination, which can be a URL, a path, an in-page anchor, or a special scheme.
External site
Internal page (relative)
Jump to an element with id="section2"
Send email
Call us
The <a> (anchor) element creates a hyperlink. Its href is the destination, which can be a URL, a path, an in-page anchor, or a special scheme.
External site
Internal page (relative)
Jump to an element with id="section2"
Send email
Call us
<a href="https://other.com" target="_blank" rel="noopener noreferrer">
Opens in a new tab
</a>
target="_blank" નવો ટેબ ખોલે છે, પરંતુ તમે rel="noopener" ઉમેરવું જોઈએ: તેના વિના, નવું પૃષ્ઠ window.opener ને ઍક્સેસ કરી શકે છે અને સંભવતઃ તમારા પૃષ્ઠને રિડાયરેક્ટ કરી શકે છે ("tab-nabbing" હુમલો). noreferrer પણ referrer header ને દૂર કરે છે. આધુનિક બ્રાઉઝર્સ _blank માટે noopener સૂચિત કરે છે, પરંતુ તેને સ્પષ્ટ રીતે ઉમેરવું શ્રેષ્ઠ પ્રથા છે.
<a href="..." rel="nofollow">Don't pass SEO ranking (untrusted/user links)</a>
<a href="..." rel="noopener">Security: no window.opener access</a>
<a href="..." rel="sponsored">Paid/affiliate link</a>
<a href="#top">Back to top</a>
...
<div id="top">...</div> <!-- the link scrolls here -->
ક્લિક કરવાથી તે તત્વ પર સ્ક્રોલ થાય છે જેનું id ફ્રેગમેન્ટ સાથે મેળ ખાય છે.
Anchors વેબના નેવિગેશનની બાકડોણ છે.
href સ્કીમ્સ (relative, absolute, fragment, mailto/tel), target="_blank" + rel="noopener" સુરક્ષા જોડી, અને SEO-સંબંધિત rel મૂલ્યોને જાણવું સાચો, સુરક્ષિત લિંકિંગ માટે આવશ્યક છે.
વિગતવાર જવાબો સાથે IT ઇન્ટરવ્યૂ પ્રશ્નોની લાઇબ્રેરી — જુનિયરથી સિનિયર સુધી.
દાન કરો