linking to page absolute location

Discussion in 'HTML' started by Phil, Nov 29, 2008.

  1. Phil

    Phil Guest

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

    --
    Phil
     
    Phil, Nov 29, 2008
    #1
    1. Advertising

  2. 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.
     
    Harlan Messinger, Nov 29, 2008
    #2
    1. Advertising

  3. Phil

    Tim Greer Guest

    Phil wrote:

    > 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.
    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
     
    Tim Greer, Nov 29, 2008
    #3
  4. "Phil" <> writes:

    > 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--

    --
    My blog: http://shermspace.blogspot.com
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, Nov 29, 2008
    #4
  5. Phil

    cwdjrxyz Guest

    On Nov 29, 12:13 pm, "Phil" <> wrote:
    > 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.
     
    cwdjrxyz, Nov 29, 2008
    #5
  6. Phil

    Phil Guest

    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.
     
    Phil, Nov 29, 2008
    #6
  7. Phil

    Tim Greer Guest

    Phil wrote:

    > 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.
    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
     
    Tim Greer, Nov 29, 2008
    #7
  8. "Phil" <> writes:

    > 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--

    --
    My blog: http://shermspace.blogspot.com
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, Nov 29, 2008
    #8
  9. Phil

    dorayme Guest

    In article <S2gYk.9369$>,
    "Phil" <> wrote:

    > 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>

    --
    dorayme
     
    dorayme, Nov 29, 2008
    #9
  10. Phil

    cwdjrxyz Guest

    On Nov 29, 12:43 pm, "Phil" <> wrote:
    > 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.
     
    cwdjrxyz, Nov 30, 2008
    #10
  11. cwdjrxyz wrote:

    > 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).

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Nov 30, 2008
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2lkIFMu?=

    Absolute cursor location

    =?Utf-8?B?U2lkIFMu?=, Dec 8, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    11,268
    Ben Amada
    Dec 9, 2004
  2. Luke Dalessandro
    Replies:
    0
    Views:
    635
    Luke Dalessandro
    Jan 15, 2006
  3. zxo102
    Replies:
    0
    Views:
    450
    zxo102
    Aug 1, 2006
  4. Jeff
    Replies:
    3
    Views:
    416
    Alexey Smirnov
    Feb 1, 2010
  5. James Byrne
    Replies:
    3
    Views:
    627
    James Byrne
    Sep 14, 2010
Loading...

Share This Page