473,756 Members | 4,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does <A HREF hyperlink require "http://..."?

Is it absolutely necessary to include "http://" in an A HREF hyperlink?
Would it be wise to remove this from one's Links page, just to save code?
Jan 4 '06 #1
31 4863
On Wed, 04 Jan 2006 18:46:49 +0100, Yeah <ye**@positive. net> wrote:
Is it absolutely necessary to include "http://" in an A HREF hyperlink?
Only for http addresses:

<URL:http://www.w3.org/Addressing/URL/5_BNF.html>
Would it be wise to remove this from one's Links page, just to save code?


If you remove it, it is no longer a URL. That doesn't sound 'wise' to me.
--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
Jan 4 '06 #2
Yeah <ye**@positive. net> wrote:
Is it absolutely necessary to include "http://" in an A HREF hyperlink?
Yes.
Would it be wise to remove this from one's Links page, just to save code?


As an example, the link page at http://www.htmlhelp.com/links/ could use
href="http://www.example.com/" and the link would refer to
http://www.example.com/

But if the link page at http://www.htmlhelp.com/links/ used
href="www.examp le.com/" instead, then the link would refer to
http://www.htmlhelp.com/links/www.example.com/ which is not the same thing
at all.

See also http://www.htmlhelp.com/faq/html/bas...l#relative-url
--
Darin McGrew, mc****@stanford alumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp. com, http://www.HTMLHelp.com/

"Shin: a device for finding furniture in the dark." - Steven Wright
Jan 4 '06 #3
Yeah wrote:
Is it absolutely necessary to include "http://" in an A HREF hyperlink?
Would it be wise to remove this from one's Links page, just to save code?


If you don't include the protocol, then it is a relative link, so if you
have a page at http://example.com/foo/index.html and links with
href="www.examp le.net" and href="http://www.example.org " the links would be
to "http://www.example.com/foo/www.example.net " and
"http://www.example.org ".

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jan 4 '06 #4
Yeah wrote:
Is it absolutely necessary to include "http://" in an A HREF hyperlink?
Would it be wise to remove this from one's Links page, just to save code?


If you had

href="www.examp le.com/mypage.html"

on the page located at http://www.example.com/otherpage.html, following
the usual rules for interpreting relative URLs, the browser would
interpret it as

http://www.example.com/www.example.com/mypage.html

Jan 4 '06 #5

Yeah Wrote:
Is it absolutely necessary to include "http://" in an A HREF hyperlink?
Would it be wise to remove this from one's Links page, just to save
code?


It depends on where the link is going. If you are on the same URL then
you don't need it.

example
<a href="new.html" > this is within the same folder on the same URL
<a href="images/picture.jpg"> this is within the same URL in a
subfolder
<a href="../file.html"> this is within the same URL but in the folder
above

If the link is going to an outside URL or you have trouble with being
within a subfolder and accessing outside of it then yes you may need to
make an absolute URL for it to follow.

Saving code really depends on what is on the page (amount of links and
size) and SEO.
--
lunaticfringe
------------------------------------------------------------------------
lunaticfringe's Profile: http://2006.html.com/forums/member.php?userid=1049
View this thread: http://2006.html.com/forums/showthread.php?t=43517

1
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jan 4 '06 #6
Darin McGrew <mc****@stanfor dalumni.org> writes:
See also http://www.htmlhelp.com/faq/html/bas...l#relative-url


I want to amplify Darin's reference, because this page includes the
important example href="./" that is too often neglected. If you have a
default file, using href="./" in place of href="index.htm l" and such
will mean consistent URLs instead of http://example.com/ and
http://example.com/index.html having the same content.

--

http://ourdoings.com/ Easily organize and disseminate news and
photos for your family or group.
Jan 4 '06 #7
Wed, 4 Jan 2006 11:46:49 -0600 from Yeah <ye**@positive. net>:
Is it absolutely necessary to include "http://" in an A HREF hyperlink?
No, of course not -- sometimes it's wrong to include that.
Would it be wise to remove this from one's Links page, just to save code?


No, that would be stupid.
But you're not asking the right question. The _right_ question is,
what's the path from the current page to the linked page? If both are
on the same server, you want a relative link; if not, you want an
absolute link. The absolute link always needs the protocol, news: or
http:// or whatever. The relative link never has the protocol or
server and, depending on details, will also omit some of the leading
"directory" names.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Jan 4 '06 #8
In article <nm************ *@grumpy-fuzzball.mit.ed u>,
Bruce Lewis <br*****@yahoo. com> wrote:
Darin McGrew <mc****@stanfor dalumni.org> writes:
See also http://www.htmlhelp.com/faq/html/bas...l#relative-url


I want to amplify Darin's reference, because this page includes the
important example href="./" that is too often neglected. If you have a
default file, using href="./" in place of href="index.htm l" and such
will mean consistent URLs instead of http://example.com/ and
http://example.com/index.html having the same content.


I like that. So the idea is you could change all your references now to
an older style default file like href="index.htm " to href="./" Then
where you finally get around to making your default file "index.html "
(or "default.ht ml" or whatever a newer default file name is) you don't
need to make a change to any of your HTML default page references?

Are there any disadvantages? Extra lookup time vs having the path
including the actual file name used?

--
http://www.ericlindsay.com
Jan 4 '06 #9
Yeah wrote:

Is it absolutely necessary to include "http://" in an A HREF hyperlink?
Would it be wise to remove this from one's Links page, just to save code?


In addition to all the other answers about relative links, you
should recognize that not all links use the hyper-text transfer
protocol (HTTP). For example, a link to send E-mail to the
anti-spam address I used for this message would be
<a href="mail:no** **@nowhere.not" >Mail to me</a>

And a link to reach this newsgroup through your default news server
would be
<a href="news:comp .infosystems.ww w.authoring.htm l">Authoring
HTML</a>
Specifying a particular news server would be
<a
href="news://news.vcnet.com/comp.infosystem s.www.authoring .html">Authorin g
HTML</a>

Generally, when I refer to a page in my own Web site from another
page in the same site, I user relative links. This facilitates
both testing and rehosting.

For testing, links relative to my home page allow me to recreate my
Web site in a local directory on my PC. This means that I can
navigate through my site without even connecting to the Internet.
Thus, I can check the appearance of a page and the integrity of
links without having to upload the pages to a Web server.

If I want to rehost my Web site, none of my links require
changing. I only have to change text that cites the domain. Yes,
I now have a personal domain, which means that rehosting merely
requires pointing the domain to the new server and uploading the
files, even if my links used complete URLs. However, if I were to
change the name of my domain, relative links mean that I would not
have to change them.

--

David E. Ross
<http://www.rossde.com/>

Concerned about someone (e.g., Pres. Bush) snooping
into your E-mail? Use PGP.
See my <http://www.rossde.com/PGP/>
Jan 4 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1897
by: Uwe Mayer | last post by:
Hi, when extending a build in class, what does the constructor __init__(...) have to return? and how does the constructor call its base-class construtor? (or is this done automatically?) I want to derive from "file" to create a class that reads record from a binary file:
24
4494
by: sinister | last post by:
After doing a websearch, it appears that it's OK to omit the "http:" to form a relative URL. Are there any pitfalls to this? For example, if there is a page http://www.domain1.com/page1.html with a link to http://www.domain2.com/page2.html you can abbreviate the second link as //www.domain2.com/page2.html
11
14650
by: whisher | last post by:
Hi. Sorry to disturb you but I can't figure out its use in this snippet (Found in many scripts about Ajax) function loadpage(page_request, containerid) { if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) { document.getElementById(containerid).innerHTML=page_request.responseText;
1
2377
by: silverachilles | last post by:
Hello, I have php code which takes an rss feed and outputs it on a page of my website. For each item it shows the link, title and description. My problem is the description element contains a lot of information (some links and other stuff) and I want to extract one of the links out of this information, so that on my webpage I am shown the link, title and the link I want out of the description, for every item. How would I achieve this? If...
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10040
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9873
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.