Questions tagged [href]

Hyperlink (or link) is a reference to a document that the reader can directly follow, or that is followed automatically.

Hyperlink (or link) is a reference to a document that the reader can directly follow, or that is followed automatically.

A hyperlink points to a whole document or to a specific element within a document. Hypertext is text with hyperlinks. A software system for viewing and creating hypertext is a hypertext system, and to create a hyperlink is to hyperlink (or simply to link). A user following hyperlinks is said to navigate or browse the hypertext.

A hyperlink has an anchor, which is the location within a document from which the hyperlink can be followed; the document containing a hyperlink is known as its source document. The target of a hyperlink is the document, or location within a document, to which the hyperlink leads. Users can activate and follow the link when its anchor is shown, usually by touching or clicking on the anchor with a pointing device. Following the link has the effect of displaying its target, often with its context.

Links are specified in HTML using the (anchor) elements. To see the HTML used to create a page, most browsers offer a "view page source" option. Included in the HTML code will be an expression in the form symbol "," marking the start of an anchor, followed by the highlighted text and the "" symbol, which indicates the end of the source anchor. The element can also be used to indicate the target of a link.

http://en.wikipedia.org/wiki/Hyperlink

5033 questions
4407
votes
56 answers

Which "href" value should I use for JavaScript links, "#" or "javascript:void(0)"?

The following are two methods of building a link that has the sole purpose of running JavaScript code. Which is better, in terms of functionality, page load speed, validation purposes, etc.? function myJsFunc() { alert("myJsFunc"); }
2cBGj7vsfp
  • 2,737
  • 3
  • 17
  • 5
2795
votes
33 answers

Open a URL in a new tab (and not a new window)

I'm trying to open a URL in a new tab, as opposed to a popup window. I've seen related questions where the responses would look something like: window.open(url,'_blank'); window.open(url); But none of them worked for me, the browser still tried to…
Mark
  • 39,169
  • 11
  • 42
  • 48
1301
votes
4 answers

Open link in new tab or window

Is it possible to open an a href link in a new tab instead of the same tab? Link
Rene
  • 13,299
  • 5
  • 19
  • 28
704
votes
5 answers
540
votes
15 answers

Open URL in same window and in same tab

I want to open a link in the same window and in the same tab that contains the page with the link. When I try to open a link by using window.open, then it opens in new tab—not in the same tab in the same window.
user1065055
  • 5,471
  • 3
  • 15
  • 4
429
votes
5 answers

href="tel:" and mobile numbers

If I use tel: I should write the international phone code, like that. 61709 So far, so good, but I can't find information on how to write a cell phone number in an "international" way, if there is one.
Sebastian Starke
  • 5,198
  • 3
  • 24
  • 35
344
votes
6 answers

window.location.href and window.open () methods in JavaScript

What is the difference between window.location.href and window.open () methods in JavaScript?
masif
  • 3,950
  • 4
  • 19
  • 22
247
votes
5 answers

How to pass a value from Vue data to href?

I'm trying to do something like this: I can't figure out how to add the value of r.id to the end of the href attribute so that I can make an API call. Any…
bbennett36
  • 6,065
  • 10
  • 20
  • 37
246
votes
5 answers

Remove ALL styling/formatting from hyperlinks

I'm creating a navigation menu with words with different colors (href links). I would like the color NOT to change on any state (hover, visited etc). I know how to set the the colors for the different states, but I would like to know the code to…
Rbijker.com
  • 2,894
  • 3
  • 21
  • 26
239
votes
10 answers

Is an empty href valid?

One of our web developers uses the following html as a placeholder for styling a drop down list. Is this considered anchor tag valid? Since there is no href value, it shows up as broken on some of our link checker…
matthew
  • 2,832
  • 3
  • 24
  • 24
226
votes
8 answers

Angular 2 router no base href set

I am getting an error and can't find why. Here is the error: EXCEPTION: Error during instantiation of LocationStrategy! (RouterOutlet -> Router -> Location -> LocationStrategy). angular2.dev.js:23514 EXCEPTION: Error during instantiation of…
Jason Spick
  • 6,028
  • 13
  • 40
  • 59
211
votes
10 answers

href image link download on click

I generate normal links like: in a web app. When I click on the link, it displays the picture in a new page. If you want to save the picture, then you need to right click on it and select…
Pierre
  • 4,976
  • 12
  • 54
  • 76
201
votes
7 answers

Get local href value from anchor (a) tag

I have an anchor tag that has a local href value, and a JavaScript function that uses the href value but directs it to a slightly different place than it would normally go. The tag looks like
Michael Plautz
  • 3,578
  • 4
  • 27
  • 40
164
votes
7 answers

Including both href and onclick to HTML tag

If I have this element: Item How can I make both href and onClick work, preferably with onClick running first?
user1589113
1
2 3
99 100