Yahoo India Web Search

Search results

  1. Learn how to use the href attribute to specify the link's destination in HTML. The href attribute can take different values, such as URLs, email addresses, phone numbers, or scripts.

  2. People also ask

  3. May 23, 2024 · The HTML <a> href attribute is used to specify the URL of the page that the link points to. When the href attribute is not present in the <a> element, it will not function as a hyperlink. This attribute is essential for creating links to any address and is used in conjunction with the <a> tag.

    • Overview
    • Attributes
    • Examples
    • Security and privacy
    • Accessibility concerns
    • Browser compatibility

    The HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address.

    Content within each should indicate the link's destination. If the href attribute is present, pressing the enter key while focused on the element will activate it.

    This element's attributes include the global attributes.

    download

    Causes the browser to treat the linked URL as a download. Can be used with or without a filename value:

    •Without a value, the browser will suggest a filename/extension, generated from various sources:

    •The Content-Disposition HTTP header

    •The final segment in the URL path

    Linking to an absolute URL
    Linking to relative URLs
    Linking to an element on the same page
    Linking to an email address
    To create links that open in the user's email program to let them send a new message, use the mailto: scheme:
    Linking to telephone numbers

    elements can have consequences for users' security and privacy. See Referer header: privacy and security concerns for information.

    Using target="_blank" without rel="noreferrer" and rel="noopener" makes the website vulnerable to window.opener API exploitation attacks, although note that, in newer browser versions setting target="_blank" implicitly provides the same protection as setting rel="noopener". See browser compatibility for details.

    Strong link text

    The content inside a link should indicate where the link goes, even out of context.

    onclick events

    Anchor elements are often abused as fake buttons by setting their href to # or javascript:void(0) to prevent the page from refreshing, then listening for their click events . These bogus href values cause unexpected behavior when copying/dragging links, opening links in a new tab/window, bookmarking, or when JavaScript is loading, errors, or is disabled. They also convey incorrect semantics to assistive technologies, like screen readers. Use a instead. In general, you should only use a hyperlink for navigation to a real URL.

    External links and linking to non-HTML resources

    Links that open in a new tab/window via target="_blank", or links that point to a download file should indicate what will happen when the link is followed. People experiencing low vision conditions, navigating with the aid of screen reading technology, or with cognitive concerns may be confused when a new tab, window, or application opens unexpectedly. Older screen-reading software may not even announce the behavior.

    BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

  4. Learn how to create hyperlinks with the HTML tag and the href attribute, which indicates the link's destination. See examples of absolute and relative URLs, target attributes, image links, email links, and more.

  5. Learn the full form and meaning of href, an HTML attribute used to create links to other pages. Find translations, similar terms and FAQs about href.

  6. Apr 13, 2021 · Learn how to use the a element and its href attribute to create hyperlinks in HTML. See different types of href values, such as absolute URLs, relative URLs, URI fragments, and more.

  1. People also search for