linking to page absolute location

P

Phil

Is there a way preferrably without javascript to link to a webpage
jumping to a specific location. Kind of like scrollTo()?
 
H

Harlan Messinger

Phil said:
Is there a way preferrably without javascript to link to a webpage
jumping to a specific location. Kind of like scrollTo()?

Yes, if the page has anchors on it (either A tags with NAME attributes,
or tags with IDs) and you link to thatpage.html#identifier.
 
T

Tim Greer

Phil said:
Is there a way preferrably without javascript to link to a webpage
jumping to a specific location. Kind of like scrollTo()?

Sure, just like you would on the page itself, you just provide the full
URL/link to the same location on the page, which that page must have
within it, of course. Nothing unusual needs to be done.
 
S

Sherm Pendley

Phil said:
Is there a way preferrably without javascript to link to a webpage
jumping to a specific location. Kind of like scrollTo()?

Yes, if the "location" has a name (for anchor elements) or id (for other
elements) to identify it. For instance:

<h2><a name="section1">Introduction</a></h2>
<h2 id="section2">More stuff</h2>

Then, you can link specifically to these elements by including a
fragment identifier in your link's URL:

<a href="example.html#section1">The introduction</a>

Or, if it's on the same page as the link, you can use the fragment
identifier by itself:

<a href="#section2">More stuff</a>

More info here:

<http://www.w3.org/TR/WD-html40-970917/struct/links.html>

sherm--
 
C

cwdjrxyz

Is there a way preferrably without javascript to link to a webpage
jumping to a specific location. Kind of like scrollTo()?

Since a few may have Javascript turned off for whatever reason, you
are right to be concerned with avoiding Javascript if the page you
wish to link to is important to the intent of your site. I likely
would use server side script, such as PHP, since it can not be turned
off by the viewing browser. One other concern about having any kind of
automatic link to another page is the security settings being used.
Some security suites and security settings allowed by some browsers
can be set to not allow such automatic links or to allow them only
after giving you a warning that you are being taken to another page.
To be on the safe side, some add a text link you can use if you are
not automatically taken to the new desired page for whatever reason,
and others just use a text link to click.
 
P

Phil

Harlan Messinger wrote:
|| Phil wrote:
||| Is there a way preferrably without javascript to link to a webpage
||| jumping to a specific location. Kind of like scrollTo()?
||
|| Yes, if the page has anchors on it (either A tags with NAME
|| attributes, or tags with IDs) and you link to
|| thatpage.html#identifier.


reply to all

what I meant to imply by 'absolute location' is without using typical
anchor id tags.

I want to refer to other pages not under my control but of course there
will not be a convenient tag where I want it so I need to have the
window jump to a location in the page.

I was hoping I could do it by maybe there was a way to specify byte
location or something to get close.
 
T

Tim Greer

Phil said:
Harlan Messinger wrote:
|| Phil wrote:
||| Is there a way preferrably without javascript to link to a webpage
||| jumping to a specific location. Kind of like scrollTo()?
||
|| Yes, if the page has anchors on it (either A tags with NAME
|| attributes, or tags with IDs) and you link to
|| thatpage.html#identifier.


reply to all

what I meant to imply by 'absolute location' is without using typical
anchor id tags.

I want to refer to other pages not under my control but of course
there will not be a convenient tag where I want it so I need to have
the window jump to a location in the page.

I was hoping I could do it by maybe there was a way to specify byte
location or something to get close.

I don't see how, unless you use a browser-side language, such as
JavaScript, etc., and if you could, that would rely on something they
might not have on their end (not installed or not enabled). You could
control where they start viewing it on your end, but on the browser
end, just linking to another site, I'm not so sure.
 
S

Sherm Pendley

Phil said:
I want to refer to other pages not under my control but of course
there will not be a convenient tag where I want it so I need to have
the window jump to a location in the page.

Without a named anchor or another element with an id, there's no
location to which to jump.
I was hoping I could do it by maybe there was a way to specify byte
location or something to get close.

Nope.

sherm--
 
D

dorayme

"Phil said:
Harlan Messinger wrote:
|| Phil wrote:
||| Is there a way preferrably without javascript to link to a webpage
||| jumping to a specific location. Kind of like scrollTo()?
||
|| Yes, if the page has anchors on it (either A tags with NAME
|| attributes, or tags with IDs) and you link to
|| thatpage.html#identifier.


reply to all

what I meant to imply by 'absolute location' is without using typical
anchor id tags.

I want to refer to other pages not under my control but of course there
will not be a convenient tag where I want it so I need to have the
window jump to a location in the page.

I was hoping I could do it by maybe there was a way to specify byte
location or something to get close.

I am reminded of Korpela's suggestion, in another thread (a Miguel
thread), that one advantage of an author IDing all his elements would be
that other authors could link into his pages.

Anyway, good question. I expect it could be something very useful to be
able to take someone to a specific part of someone else's very long page
that is not decked out with any IDs that can be latched onto.

One thing that long pages are always decked out with are words and
phrases. There should be a way to <a href="reallyLongPage#'Tired with
all these, for restful death I cry,'">A page of sonnets</a>
 
C

cwdjrxyz

Harlan Messinger wrote:
|| Phil wrote:

||| Is there a way preferrably without javascript to link to a webpage
||| jumping to a specific location. Kind of like scrollTo()?
||
|| Yes, if the page has anchors on it (either A tags with NAME
|| attributes, or tags with IDs) and you link to
|| thatpage.html#identifier.

reply to all

what I meant to imply by 'absolute location' is without using typical
anchor id tags.

I want to refer to other pages not under my control but of course there
will not be a convenient tag where I want it so I need to have the
window jump to a location in the page.

I was hoping I could do it by maybe there was a way to specify byte
location or something to get close.

I can see one possible way. You would have to locate a position on the
page where a certain word or group of words appears that will serve as
your target. Then, using server side PHP, a header exchange would
examine the page using regular expressions to locate the word or words
you choose as the target for the page. The page is then made to scroll
down to where these words first appear. This sort of thing often is
done to find the first instance of a word or group of words in a file.
I have not tried this, so I do not have an example at hand. If you ask
at a php ng, someone might have an example. This likely could also be
done with Javascript with the disadvantage that it would not work for
those who turn their script off.
 
J

Jukka K. Korpela

cwdjrxyz said:
I can see one possible way. You would have to locate a position on the
page where a certain word or group of words appears that will serve as
your target. Then, using server side PHP,

Well, maybe PHP, maybe some other server-side technology.
a header exchange would
examine the page using regular expressions to locate the word or words
you choose as the target for the page.

Pardon? Can you show a demo? (That is, give us a URL.) Header exchange
sounds quite irrelevant.
The page is then made to scroll
down to where these words first appear.

How? The question was how to do this, and now you include it as an assumed
part of your proposed solution. I guess "petitio principi" is the Latin name
for this type of error in logic.

This sort of thing often is
done to find the first instance of a word or group of words in a file.
I have not tried this, so I do not have an example at hand.

That's what I suspected.

What you _can_ actually to is to set up a server-side script that accepts a
URL and something else, like a keyword, and returns a document fetched from
that URL and then postprocessed by adding a destination anchor, or anchors,
at suitable place(s) and some links at the start. Even this way, the
document will not be positioned at a particular location, but there is a
simple link, or links, at the start for the user to utilize.

Google actually does such things, as you can see if you ever look at a link
named "Cached" in Google results. It's not a simple link to a cached
version; instead, it is a link to such a version processed by highlighting
the keyword(s) used as the occur on the page. You could so something
similar, just with the fairly trivial addition of a link that goes to the
first occurrence of a keyword. And you could even turn that occurrence to a
link to the next occurrence, though this requires some extra care to avoid
nested <a> elements (which are not allowed by HTML syntax).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top