Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7618411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:23:49+00:00 2026-05-31T03:23:49+00:00

<a href=’/a01′></a> If I were to check .href of that using javascript, it would

  • 0
<a href='/a01'></a>

If I were to check .href of that using javascript, it would give the full path, instead of /a01.

Using getAttribute does return the full path, however it is much slower than .href. Is there a fast way to get the actual href?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:23:50+00:00Added an answer on May 31, 2026 at 3:23 am

    If you’re saying that you only want the path, then use the .pathname property instead of the .href property.

    There are also .search and .hash for the querystring and hash tag. There are a number of others as well.


    Another option is…

    elem.attributes['href'].value;
    

    …but I’d be surprised if it was quicker. I’m not certain of browser compatibility issues either.

    And another few…

    elem.attributes.getNamedItem('href').value;
    elem.attributes.item('href').value;
    elem.getAttributeNode('href').value
    

    If the .value property gives you trouble in older browsers, try nodeValue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using javascript:parent.location.href in an IFrame to change the parent window, IE briefly changes
I have a dynamic href that does not have a class or id and
I have an href in HTML that I dynamically produce from a server. I
jQuery hyperlinks - href value? text][1] I am running in to a problem using
I have a href link and I would like it to be clicked when
I need to use href instead click event so I can use hover in
window.location.href does not work to save the current web page url as a bookmark.
javascript: location.href(somefile.php); // successfully working with IE location.href = somefile.php; Ques 1. first code
in an href in html, whats the difference between using <a href=http://www.somesite.com/ name=The Name>
I need to update href value thorughout the page using jquery. Say href=http://www.google.com?gsec=account should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.