2

When I post a link, I want to make sure the page opens at a particular place on the page by editing the URL. Is there a simple way to do that?

I must say I figured this was a simple enough question that a few minutes of googling should be enough to solve, but this has proven to not be the case. I'm hoping you all can help me out.

2 Answers 2

4

Generally it's pretty easy, you would append a hash (#) and the id of an element (generally in the HTML you would see <div id="something"> and you would use #something.

As an example on this page:

https://superuser.com/questions/627193/how-do-i-edit-a-url-so-that-it-forces-you-to-a-particular-spot-on-the-page-it-op#answers

I had to right click and inspect the element to see the id, it helps to have the developer tools/firebug/etc installed and activated (on Firefox/Chrome).

On Safari, you'd need to turn on the dev console I believe.

On Internet Explorer, you probably have to manually search - but someone else may have a suggestion there.

1
  • I've been using the web since there was a web, and I did not know this. I knew about anchors, but not the div id trick. Thanks!
    – MattDMo
    Commented Aug 2, 2013 at 19:13
2

If it concerns a page you wrote, (or if they are already present) you can use HTML anchors.

Otherwise, it's not possible to give a location in a webpage in the URL.

3
  • not true - see nerdwaller's answer...
    – MattDMo
    Commented Aug 2, 2013 at 19:11
  • @MattDMo This debate has already occurred (even if the comments were deleted), and we are both telling the same thing : the only way to achieve what the asker wants are HTML anchors. And if there are no anchors already on the page, you can't create such link.
    – Levans
    Commented Aug 2, 2013 at 19:19
  • You're right, I should have read through your link more carefully. I can't undo my vote (time limit), but if you make a minor edit to your post I will gladly change it. My bad...
    – MattDMo
    Commented Aug 2, 2013 at 19:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .