The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Other
> Dev Shed Lounge
|
URL to automatically jump to a section of the page
Discuss URL to automatically jump to a section of the page in the Dev Shed Lounge forum on Dev Shed. URL to automatically jump to a section of the page Dev Shed Lounge forum discussing anything that doesn't fit into the other forums. This is a place to relax, talk, and even have some friendly debate. Walk softly and carry a big wiffle bat.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

May 24th, 2010, 09:00 PM
|
 |
They're coming to take me away
|
|
Join Date: Jan 2005
Location: Florida
|
|
|
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!"
|

May 24th, 2010, 10:45 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
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/m...acs.html#Screen
__________________
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
Last edited by Scorpions4ever : May 24th, 2010 at 10:49 PM.
|

May 25th, 2010, 10:12 PM
|
 |
They're coming to take me away
|
|
Join Date: Jan 2005
Location: Florida
|
|
Quote: | 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/m...acs.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 
|

May 26th, 2010, 10:06 AM
|
|
Contributing User
|
|
Join Date: May 2006
Location: I'm sneaking up behind you.
|
|
|
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?
|

May 26th, 2010, 12:47 PM
|
 |
They're coming to take me away
|
|
Join Date: Jan 2005
Location: Florida
|
|
Quote: | 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.
|

May 27th, 2010, 03:36 AM
|
|
Contributing User
|
|
Join Date: May 2006
Location: I'm sneaking up behind you.
|
|
|
Sorry, overlooked that part of the post. AFAIK, it is not possible without access to the code.
|

March 7th, 2013, 05:45 PM
|
|
Registered User
|
|
Join Date: Jul 2012
Posts: 6
Time spent in forums: 1 h 16 m 50 sec
Reputation 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")?
|

March 7th, 2013, 05:50 PM
|
|
Registered User
|
|
Join Date: Jul 2012
Posts: 6
Time spent in forums: 1 h 16 m 50 sec
Reputation Power: 0
|
|
Quote: | 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
|

March 8th, 2013, 03:42 PM
|
 |
Likely to be eaten by a grue.
|
|
Join Date: Oct 2006
Location: Pennsylvania, USA
|
|
|
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.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|