By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,767 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,767 IT Pros & Developers. It's quick & easy.

referencing the index.html page from another page in the same directory

P: n/a
In my public_html directory, I have a bunch of files:
index.html
x.html, y.html, etc.

When a user accesses the domain without a file name,
he/she automatically accesses the index.html file.
So, we he/she goes to x.html or y.html, I have
back-pointers to index.html.

I was using:
<a href="">Back to the homepage</a>.
This worked fine in Internet Explorer, but in Firefox
it basically takes the user back to the top of the current
page. To make things work with Firefox I end having to say:
<a href="full original domain name without the index.html">Back to
my homepage</a>.

Is this:
(a) A problem with Firefox?
(b) A problem with my html code that ends up having unpredictable
results depending on the browser type?

Anoop
Jul 20 '05 #1
Share this Question
Share on Google+
22 Replies


P: n/a
Anoop Ghanwani wrote:
I was using:
<a href="">Back to the homepage</a>.
This worked fine in Internet Explorer, but in Firefox
it basically takes the user back to the top of the current
page. (a) A problem with Firefox?
AFAIK, the behavour of browsers for null URIs is undefined.
(b) A problem with my html code that ends up having unpredictable
results depending on the browser type?


Use href="/", "./", "index.html", or "/index.html"
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 20 '05 #2

P: n/a
Anoop Ghanwani wrote:
In my public_html directory, I have a bunch of files:
index.html
x.html, y.html, etc.

When a user accesses the domain without a file name,
he/she automatically accesses the index.html file.
So, we he/she goes to x.html or y.html, I have
back-pointers to index.html.

I was using:
<a href="">Back to the homepage</a>.
This worked fine in Internet Explorer, but in Firefox
it basically takes the user back to the top of the current
page. To make things work with Firefox I end having to say:
<a href="full original domain name without the index.html">Back to
my homepage</a>.

Is this:
(a) A problem with Firefox?
(b) A problem with my html code that ends up having unpredictable
results depending on the browser type?


<a href=""> means nothing. IE happens to interpret it as you want. You
could use <a href="index.html"> or <a href="/">.

--
Mark.
Jul 20 '05 #3

P: n/a
gh******@gmail.com (Anoop Ghanwani) wrote:
In my public_html directory, I have a bunch of files:
index.html
x.html, y.html, etc.

When a user accesses the domain without a file name,
he/she automatically accesses the index.html file.
So, we he/she goes to x.html or y.html, I have
back-pointers to index.html.

I was using:
<a href="">Back to the homepage</a>.
Oh dear. The behaviour of empty URLs as links is undefined.
This worked fine in Internet Explorer, but in Firefox
it basically takes the user back to the top of the current
page. To make things work with Firefox I end having to say:
<a href="full original domain name without the index.html">Back to
my homepage</a>.
Why? Why not just <a href="index.html">My homepage</a> or
<a href="/">My homepage</a> ?
(Drop the 'back to' as the user may have arrived at your page via a
search engine or bookmark and thus might not be going 'back' at all.)
Is this:
(a) A problem with Firefox?
(b) A problem with my html code that ends up having unpredictable
results depending on the browser type?


(b)

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #4

P: n/a
gh******@gmail.com (Anoop Ghanwani) wrote in
news:67**************************@posting.google.c om:
In my public_html directory, I have a bunch of files:
index.html
x.html, y.html, etc.

When a user accesses the domain without a file name,
he/she automatically accesses the index.html file.


Just in case you didn't know, that's not "magic" - it
happens because your webserver is configured to serve
index.html, if present, as the index document for the
specified resource(the root of your website).
You may find that the webserver is configured to serve other
index documents as well, such as index.php, index.htm, etc.

--
Dave Patton
Canadian Coordinator, Degree Confluence Project
http://www.confluence.org/
My website: http://members.shaw.ca/davepatton/
Jul 20 '05 #5

P: n/a
Anoop Ghanwani wrote:
I was using:
<a href="">Back to the homepage</a>.
This worked fine in Internet Explorer, but in Firefox
it basically takes the user back to the top of the current
page. To make things work with Firefox I end having to say:
<a href="full original domain name without the index.html">Back to
my homepage</a>.


I discuss the issue of linking back to the main index in my site:

http://webtips.dan.info/subdir.html

The method I use is <A HREF="./">.

--
== Dan ==
Dan's Mail Format Site: http://mailformat.dan.info/
Dan's Web Tips: http://webtips.dan.info/
Dan's Domain Site: http://domains.dan.info/
Jul 20 '05 #6

P: n/a
Anoop Ghanwani wrote:
When a user accesses the domain without a file name,
he/she automatically accesses the index.html file.
So, we he/she goes to x.html or y.html, I have
back-pointers to index.html.

I was using:
<a href="">Back to the homepage</a>.


use <a href="./">back to the homepage</a> (or if it's the root of the
site, use <a href="/">back to the homepage</a>).

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #7

P: n/a
"Brian" <us*****@julietremblay.com.invalid> a écrit dans le message de
news:10*************@corp.supernews.com
use <a href="./">back to the homepage</a>


Never seen this synthax before : does this reference the current directory ?
Where is it defined ? Does it works for any webserver on any platform ?

Jul 20 '05 #8

P: n/a
Pierre Goiffon wrote:
"Brian" <us*****@julietremblay.com.invalid> a écrit dans le message de
news:10*************@corp.supernews.com
use <a href="./">back to the homepage</a>



Never seen this synthax before : does this reference the current directory ?
Where is it defined ? Does it works for any webserver on any platform ?


Every web server is configured with one or more "default" filenames:
usually index.* and default.*.

This syntax requests whatever file the web server has been configured to
serve, within the current directory.

So if you're looking at /foo/bar/wibble.html, "./" will request
/foo/bar/, which will result in something like /foo/bar/index.html being
served.

--
Mark.
Jul 20 '05 #9

P: n/a
"Mark Tranchant" <ma**@tranchant.plus.com> a écrit dans le message de
news:ZN*******************@stones.force9.net
So if you're looking at /foo/bar/wibble.html, "./" will request
/foo/bar/, which will result in something like /foo/bar/index.html
being served.


Yes that was what I understood (sorry for my bad level of english, it seems
I wasn't that clear in my previous post), but I never seen this anywhere.
Nor in use, nor in any spec. So I was wondering if it could be used safely,
if there is a wide support for that ?

Jul 20 '05 #10

P: n/a
Pierre Goiffon wrote:
"Brian" a écrit
use <a href="./">back to the homepage</a>
does this reference the current directory ?


Yes.
Where is it defined ?
http://www.ietf.org/rfc/rfc2396.txt

(Brace yourself: reading an rfc is not for the faint of heart.)
Does it works for any webserver on any platform ?


Not sure I follow. A url is independent of the filesystem of the
server, right?

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #11

P: n/a
Pierre Goiffon wrote:
"Mark Tranchant" <ma**@tranchant.plus.com> a écrit dans le message de
news:ZN*******************@stones.force9.net
So if you're looking at /foo/bar/wibble.html, "./" will request
/foo/bar/, which will result in something like /foo/bar/index.html
being served.


Yes that was what I understood (sorry for my bad level of english, it seems
I wasn't that clear in my previous post), but I never seen this anywhere.
Nor in use, nor in any spec. So I was wondering if it could be used safely,
if there is a wide support for that ?


I've been doing my links back home that way for over nine years now, and
have never had a problem with it.

--
Dan
Jul 20 '05 #12

P: n/a
"Brian" <us*****@julietremblay.com.invalid> a écrit dans le message de
news:10*************@corp.supernews.com
use <a href="./">back to the homepage</a>
Where is it defined ?


http://www.ietf.org/rfc/rfc2396.txt


Thanks a lot ! I missed that reading that RFC long ago... In fact at that
time I wasn't searching for that, and didn't think go reading this now.
Well, a standard thing, seems well implemented... nice stuff, I'm surely
going to play with it ! (indeed after more than 7 years of making web sites
as a job, it's time to begin :o) )

Jul 20 '05 #13

P: n/a
In <67**************************@posting.google.com >, on 07/25/2004
at 11:48 PM, gh******@gmail.com (Anoop Ghanwani) said:
I was using:
<a href="">Back to the homepage</a>.


Shouldn't that have been

<a href="index.html">Back to the homepage</a>

rather than an empty href?

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to sp******@library.lspace.org

Jul 20 '05 #14

P: n/a
Pierre Goiffon wrote:
"Mark Tranchant" <ma**@tranchant.plus.com> a écrit dans le message de
news:ZN*******************@stones.force9.net
So if you're looking at /foo/bar/wibble.html, "./" will request
/foo/bar/, which will result in something like /foo/bar/index.html
being served.


Yes that was what I understood (sorry for my bad level of english, it seems
I wasn't that clear in my previous post), but I never seen this anywhere.
Nor in use, nor in any spec. So I was wondering if it could be used safely,
if there is a wide support for that ?


The concept of / for the root, ./ for the current directory and ../ for
the parent directory is older than me. It's surprising you've never seen
it anywhere!

From google.co.uk:
<a href=/advanced_search?hl=en>Advanced Search</a>
<a href=/about.html>About Google</a>

From google.co.uk/about.html:
<a href="/"><img src="/images/about_logo.gif" --snip--></a>

It's very common, and very neat.

--
Matt
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #15

P: n/a
On Mon, 26 Jul 2004, Shmuel (Seymour J.) Metz wrote:
<a href="">Back to the homepage</a>.
Shouldn't that have been

<a href="index.html">


It should have been href="./" , as any experienced practitioner could
have told you.

Actually, I have the impression that several of them already did!
Back to the homepage</a>


"Back to"??? But if I've never been to the associated homepage
before, I'm jusst going to think how little the author understands the
WWW, aren't I?
Jul 20 '05 #16

P: n/a
"Matt" <no******@spam.matt.blissett.me.uk> a écrit dans le message de
news:pa****************************@spam.matt.blis sett.me.uk
The concept of / for the root, ./ for the current directory and ../
for the parent directory is older than me. It's surprising you've
never seen it anywhere!


I'm surprised myself. "/" and "../" are very common and I used them a lot.
But never, never seen "./" before in a WWW context. Well, I guess Usenet is
a good place to learn :)

Jul 20 '05 #17

P: n/a
Thanks for the corrections and suggestions.
I've fixed my pages to use:
<a href="./">To my homepage...</a>, instead of
<a href="">Back to my homepage...</a>.

It now works great in both IE and Firefox.

Anoop
Jul 20 '05 #18

P: n/a
David Dorward <do*****@yahoo.com> wrote:
AFAIK, the behavour of browsers for null URIs is undefined.


In HTML, "URI" effectively stands for what RFC 2396 calls "URI reference"
(otherwise you could not use href="#foo" to refer to a location inside
the same document), and RFC 2396 specifies:

"4.2. Same-document References

A URI reference that does not contain a URI is a reference to the current
document. In other words, an empty URI reference within a document is
interpreted as a reference to the start of that document, and a reference
containing only a fragment identifier is a reference to the identified
fragment of that document. Traversal of such a reference should not
result in an additional retrieval action. However, if the URI reference
occurs in a context that is always intended to result in a new request,
as in the case of HTML's FORM element, then an empty URI reference
represents the base URI of the current document and should be replaced by
that URI when transformed into a request."

And URI reference is defined syntactically as
[ absoluteURI | relativeURI ] [ # fragment ]
so it can be an empty string.

However, I would not count on that, since browsers are known to fail to
comply with this, and it's an odd concept anyway.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #19

P: n/a
In <Pi******************************@ppepc56.ph.gla.a c.uk>, on
07/26/2004
at 11:11 PM, "Alan J. Flavell" <fl*****@ph.gla.ac.uk> said:
It should have been href="./" , as any experienced practitioner could
have told you.
That would be true if they did the same thing. They don't, as any
experienced practitioner could have told you. Read what the OP
requested carefully and you might even be able to figure out why.
Actually, I have the impression that several of them already did!
That impression is equally mistaken, on two counts. I'll let you
figure out why.
"Back to"??? But if I've never been to the associated homepage
before, I'm jusst going to think how little the author understands
the WWW, aren't I?


Boy, you really are inent on digging yourself into a hole, aren't you?
"Back to the homepage" was the wording that the original poster
requested. Further, while that wording is inappropriate in some cases,
it appears on quite a few web pages, as any experienced practitioner
could have told you.

Gurl qba'g ernyyl unir synzrf ba Hfrarg. Gurl guvax gurl qb, ohg
gung'f bayl orpnhfr gurl'ir arire frra gur erny guvat. Onpx va gur byq
qnlf, orsber SVQB, jura zra jrer zra naq furrc jrer fpnerq, gurer jrer
fbzr erny synzrf.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to sp******@library.lspace.org

Jul 20 '05 #20

P: n/a
On Sun, 01 Aug 2004 19:27:26 -0300, "Shmuel (Seymour J.) Metz"
<sp******@library.lspace.org.invalid> wrote:
In <Pi******************************@ppepc56.ph.gla.a c.uk>, on
07/26/2004
at 11:11 PM, "Alan J. Flavell" <fl*****@ph.gla.ac.uk> said:
It should have been href="./" , as any experienced practitioner could
have told you.
That would be true if they did the same thing. They don't, as any
experienced practitioner could have told you. Read what the OP
requested carefully...
I have; and the only thing I can see is that he has "back-pointers to
index.html".

As usual in many cases like this, the lack of an illustrational URL from
the OP leaves us all here to assume that a look into the "crystal ball"
/may/ guide us all to some kind of a correct comment.
and you might even be able to figure out why.
From me to you; get off your high horse before you hurt yourself.

[...snipped more BS...]
"Back to"??? But if I've never been to the associated homepage
before, I'm jusst going to think how little the author understands
the WWW, aren't I?

"Back to the homepage" was the wording that the original poster
requested...
No, hi did not _request_ "Back to the homepage" as words, he said that
he had "back-pointers to index.html", still to us old boneheads that
means that he has created plain (X)HTML anchors with URL's that was
supposed to point to his index.html.
...Further, while that wording is inappropriate in some cases,
it appears on quite a few web pages, as any experienced practitioner
could have told you.
Yes, the world is filled with errors in all aspects of all subjects.
Gurl qba'g ernyyl unir synzrf ba Hfrarg. Gurl guvax gurl qb, ohg
gung'f bayl orpnhfr gurl'ir arire frra gur erny guvat. Onpx va gur byq
qnlf, orsber SVQB, jura zra jrer zra naq furrc jrer fpnerq, gurer jrer
fbzr erny synzrf.


Lucky for you, you did not post this to 'ciwas', your whole post would
have been off-topic :-)

Decoded for those of you who do not have a Rot13 device at your
fingertips...

"They don't really have flames on Usenet. They think they do,
but that's only because they've never seen the real thing.
Back in the old days, before FIDO, when men were men and sheep
were scared, there were some real flames."

Well, Usenet would not be Usenet without characters like you I guess,
but stay away from giving misinformation, or at least if you feel a need
to "educate" others, do so from a described and solid foundation.

You "flunked" that in this last post of yours.

--
Rex
Jul 20 '05 #21

P: n/a
In <6v********************************@4ax.com>, on 08/02/2004
at 03:23 AM, Jan Roland Eriksson <jr****@newsguy.com> said:
I have; and the only thing I can see is that he has "back-pointers to
index.html".
Then I guess that you don't see very well either.
As usual in many cases like this, the lack of an illustrational URL
from the OP leaves us all here to assume that a look into the
"crystal ball" /may/ guide us all to some kind of a correct comment.
No crystal ball is needed in this case. All that is needed is the
plausible assumption that the OP wants a proper error message should
index.html actually be missing from the current directory.
From me to you; get off your high horse before you hurt yourself.
PKB. You might try actually reading the article that I was responding
to, and taking my response in that context.

No, hi did not _request_ "Back to the homepage" as words,
Are you blind? The OP wrote

<a href="">Back to the homepage</a>

That includes the exact text in question.
Well, Usenet would not be Usenet without characters like you I
guess, but stay away from giving misinformation, or at least if you
feel a need to "educate" others, do so from a described and solid
foundation.
That advice would be more useful for Mr. Flavell, whose sarcasm ill
becomes the level of "expertise" he displayed. For that matter, you
would do well to take your own advice.
You "flunked" that in this last post of yours.


PKB.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to sp******@library.lspace.org

Jul 20 '05 #22

P: n/a
Shmuel (Seymour J.) Metz wrote:
In <6v********************************@4ax.com>, on 08/02/2004
at 03:23 AM, Jan Roland Eriksson <jr****@newsguy.com> said:
You "flunked" that in this last post of yours.

PKB.


Peekaboo?
Matthias

Jul 20 '05 #23

This discussion thread is closed

Replies have been disabled for this discussion.