I'd like to create a Safari bookmark that automatically scrolls to a specific position on the page. The page in question is not under my control, and has no in-page anchors. I have a vague notion of something being done via a bit of Javascript saved inside the bookmark, but don't know if even possible, how to implement.


Without an anchor in the page, as far as I know a normal bookmark can't do that, but a bookmarklet – i.e. a chunk of JavaScript code – probably can. Whether it's possible depends a bit on what you mean by “a specific position”.

If all you want to do is scroll, say, 2000 pixels down the page each time, it would possible to write a bookmarklet using JavaScript's scrollTo function that does that - but bear in mind that the layout (and hence length) of the page may change depending on the size of your browser window, so this may not be too reliable.

If it's a particular block of content within the page you want to scroll to, it might be a bit trickier. Provided there's a unique bit of HTML near that point in the page, a bookmarklet could dynamically insert an anchor there once the page is loaded, and then navigate to it.

This is probably not the place for detailed advice on writing bookmarklets, however - that's what Stack Overflow is for.

| improve this answer | |

You must log in to answer this question.

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