#1
  1. They're coming to take me away

    Join Date
    Jan 2005
    Location
    Florida
    Posts
    5,105
    Rep Power
    5049

    URL to automatically jump to a section of the page


    So.. wasn't sure where to put this, but was wondering if there was a way to automatically go to a section of the page by adding something to the URL...

    Basically, there's a website that has a bunch of articles on it. One written by someone who wants to link to it in her portfolio. Right now, it's the last article on the page, however, later on, more articles will be added. So, if the article was titled "Summer Beans", is there something I can add to the URL to bring that section of the page to the top of the browser so a visitor doesn't need to scroll down to the bottom (or to wherever the article is located)..?

    Thanks.. if you need further clarification, let me know.
    "I don't need to get a life. I'm a gamer. I have lots of lives!"
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    Only if the page has anchor tags in it (<a name="foo"></a>).

    Then you can make your URL like this:
    http://www.mysite.com/page.html#foo

    and the browser will scroll down to the relevant section.

    For example, this page has anchor tags on it, and I can bounce you to a specific section like this:
    http://www.gnu.org/software/emacs/ma...cs.html#Screen
    Last edited by Scorpions4ever; May 24th, 2010 at 10:49 PM.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. They're coming to take me away

    Join Date
    Jan 2005
    Location
    Florida
    Posts
    5,105
    Rep Power
    5049
    Originally Posted by Scorpions4ever
    Only if the page has anchor tags in it (<a name="foo"></a>).

    Then you can make your URL like this:
    http://www.mysite.com/page.html#foo

    and the browser will scroll down to the relevant section.

    For example, this page has anchor tags on it, and I can bounce you to a specific section like this:
    http://www.gnu.org/software/emacs/ma...cs.html#Screen
    Thanks for the reply. Was hoping there was some way without using anchors as she doesn't have access to the code. Just an article she wrote that was published on a site. Oh well... Figured I'd try... Thanks
    "I don't need to get a life. I'm a gamer. I have lots of lives!"
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2006
    Location
    I'm sneaking up behind you.
    Posts
    1,490
    Rep Power
    832
    Have a div (or any element for that matter) with an id, like so <div id="myid"> .
    http://mysite.com/mypage.php#myid , you will be taken to the section of the page that contains <div id="myid">.
    Why do we always seek someone, something or some thought? Are we afraid of ourselves?
  8. #5
  9. They're coming to take me away

    Join Date
    Jan 2005
    Location
    Florida
    Posts
    5,105
    Rep Power
    5049
    Originally Posted by srisa
    Have a div (or any element for that matter) with an id, like so <div id="myid"> .
    http://mysite.com/mypage.php#myid , you will be taken to the section of the page that contains <div id="myid">.
    As I mentioned in my last post, she doesn't have access to the code. I wasn't sure if there was some parameter that you could pass in the URL to essentially search for keywords or something (http://www.domain.com/page.aspx?search=String%20Beans)... Figured there wasn't, but as I've never needed this before, I hadn't done a lot of searching on the matter. When this question was presented to me is when I started looking on google and then asking in here.

    Thanks.
    "I don't need to get a life. I'm a gamer. I have lots of lives!"
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2006
    Location
    I'm sneaking up behind you.
    Posts
    1,490
    Rep Power
    832
    Sorry, overlooked that part of the post. AFAIK, it is not possible without access to the code.
    Why do we always seek someone, something or some thought? Are we afraid of ourselves?
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    6
    Rep Power
    0

    Is it ever possible to create a URL that jumps to class="foo"?


    Is it ever possible to create a URL that jumps to class="foo"?

    I have never seen this using regular HTML.

    Obviously, jumping to class="foo" isn't the same as jumping to id="bar" (where in the latter, you could simply create a URL of URLgoesHere#bar).

    But does anyone know of a Javascript snippet that could force a URL (when clicked) to open the primary URL and jump down the page to say .foo(0) (i.e., the first appearance of class="foo")?
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    6
    Rep Power
    0
    Originally Posted by jacob22berk
    Is it ever possible to create a URL that jumps to class="foo"?

    I have never seen this using regular HTML.

    Obviously, jumping to class="foo" isn't the same as jumping to id="bar" (where in the latter, you could simply create a URL of URLgoesHere#bar).

    But does anyone know of a Javascript snippet that could force a URL (when clicked) to open the primary URL and jump down the page to say .foo(0) (i.e., the first appearance of class="foo")?
    As a side note, it can be simple to find a div (with id="bar") that is close to the class element you are trying to create a URL to jump to, and use that as a sort of hack, i.e., URLgoesHere#BARthatisclosetoFOO
  16. #9
  17. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    Hiker, I had this idea in college, and me and my Exploiting the Information World group hacked at it for nearly a month before giving up. Sadly, the best you can do is abuse the link IDs if there are any, or tell people how to use ctrl+f.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo