From: Garrett Smith on
On 2010-08-09 07:38 PM, Linda wrote:
> On Aug 9, 5:58 pm, Garrett Smith wrote:
>
>> A fragment identifier is the way to do that:
>> <a href="/#top">Go Back</a>
>
> This looked interesting. I tried using it as written but it did not
> work as I expected. I am using Safari 5.0.1 on Mac OS X. When I
> click on the Go Back link, it opens Finder to the root directory on
> the Mac.
>
So you are using a local file protocol, huh?

This is an HTML question, so I've added a followup to
comp.infosystems.www.authoring.html (CIWAS). HTML is the language for
web site navigation and the best NG for that is CIWAS.

First change the path in that link to go to the page you want to link
to. Next, set the fragment identifier to point to the id of an element
(or a named anchor) in the target page.

For example, if the target page is the default file at the root of your
website, the path would be "/". If the default file mapping for the
webserver is "index.html", then open up that index.html file and add an
id to an element you want to target:

<h1 id="top">Hey there how about corn!</h1>
--
Garrett
From: Linda on
On Aug 9, 11:34 pm, Garrett Smith wrote:
> So you are using a local file protocol, huh?

Yes.
> First change the path in that link to go to the page you want to link
> to. Next, set the fragment identifier to point to the id of an element
> (or a named anchor) in the target page.

The previous page is not always the same page. I think that I
understand that what you are writing is that I should use:

<a href="somepage.html#top">

However, I need to use the browser's history instead since I will not
always know which was the previous page. i.e. "somepage.html" may not
always be the referrer.

When the Back button is clicked on the second page, I want to go to
the top of the referrer and not to the position in the page where
there was a link to the second page.

This should be a javascript question rather than an HTML question.

Linda
From: Ry Nohryb on
On Aug 10, 7:59 am, Linda <1anml...(a)gmail.com> wrote:
> (...)
> When the Back button is clicked on the second page, I want to go to
> the top of the referrer and not to the position in the page where
> there was a link to the second page. (...)

If by "back button" you mean the browser's back button, then I think
the answer is no, you can't. IIRC it's not possible to read the
history object's entries. IIRC you can only do history.back() and
history.forward() and history.go(), but when you do so you've got no
chance to clean the "#" from the destination url before navigating to
it, which is what you seem to need.

But if you've put your own back button in the page, you could attempt
to go back by doing something like location.href=
cleanUp(document.referrer), where cleanUp takes care of removing any #
part of the referer url, methinks.
--
Jorge.
From: Chris F.A. Johnson on
On 2010-08-09, Linda wrote:
><input type="button" value="Back" onClick="javascript:
> history.go(-1)">
>
> In the previous page, the link to the current page is at the bottom of
> the page. When I hit the back button on the current page, when the
> previous page loads, it opens near the bottom of the page (where the
> link is located). Is there a way to make the previous page open at
> the top of the page using the onclick of this button?

<http://cfajohnson.com/testing/a001.html>

Files go from a001 to z999.

The script that does the work is
<http://cfajohnson.com/testing/back.cgi>, which you can see here:
<http://cfajohnson.com/testing/back.txt>

--
Chris F.A. Johnson
<http://torontowebdesign.cfaj.ca>
From: Chris F.A. Johnson on
On 2010-08-09, Linda wrote:
><input type="button" value="Back" onClick="javascript:
> history.go(-1)">
>
> In the previous page, the link to the current page is at the bottom of
> the page. When I hit the back button on the current page, when the
> previous page loads, it opens near the bottom of the page (where the
> link is located). Is there a way to make the previous page open at
> the top of the page using the onclick of this button?

<http://cfajohnson.com/testing/a001.html>

Files go from a001 to z999.

The script that does the work is
<http://cfajohnson.com/testing/back.cgi>, which you can see here:
<http://cfajohnson.com/testing/back.txt>


--
Chris F.A. Johnson
<http://torontowebdesign.cfaj.ca>