Ask HN: How would you link to specific parts of a page?

https://news.ycombinator.com/item?id=1964608
by Skywing • 16 years ago
8 9 16 years ago

Hi all,

The other day, a friend and I were eating lunch and I was dropping my usual, subliminal "so, any cool neat ideas for websites?" type questions. He always seems to have complaints about the web, which are good for somebody like me (always looking for fun projects). After some discussion we started coming up with a pretty neat sounding idea.

The idea is to be able to highlight some text on a page, and create a permalink to the page that shows those highlights. For example, you're on Wikipedia and see a sweet quote, or really important word, and you want your buddy to read it. You could copy and paste it to him, over AIM or something, and then send him the URL, too. Or you could just send him the URL and say "scroll down to the third paragraph." Or, you could use this idea and highlight that quote or word somehow and create a permalink to that exact word. It would function exactly like HTML anchors do, but without requiring that page to have an anchor where you want to link to.

I don't know if anything likes this exists in a pure Javascript form or not. I know there are browser plugins that can kind of do this. I know some blogs append anchors to every paragraph for this. But, that doesn't really matter, I'm just trying to figure out how this would be possible without using those methods.

I was thinking in terms of Javascript, but I'm not sure if it's quite possible. I'm pretty sure you can't load up the page being linked to in an iframe and run javascript on it. I know you can't ask that page to load your JS.

Does anyone have any ideas on how this could be possible without a browser plugin?

Edit: I have also thought about a bookmarklet. This would allow you to generate a link to a certain area of a page, using whatever algorithms you had to find that area and create a link. But, I don't know how it would work in the opposite direction: going from link -> area of page.

Related Stories

Loading related stories...

Source preview

news.ycombinator.com