1

There are similar questions on SO, but this one is unique because I have no access to the code I am linking to. I often share links to other pages when giving answers on SO, forums, IRC, etc. Rather than having to say, "Follow this link and search for the 5th occurance of the word 'reminder'." I'd like to just link directly to it. I always view source and look for tags with id set or (rarely ever seen anymore) anchors with name set. But, if I don't find any, I don't know what to do.

UPDATE: Just like every other question on SO and result I've found on Google, I'm already getting responses that assume writing code or installing something. So, let me be very clear:

If you can't actually post an example link here on SO, then it is not a solution.

Digression: There should be a standard for searching/scrolling/highlighting in URLs. Perhaps http://example.com/#/reminder/[5] would scroll to (and highlight would be nice) the 5th occurrence of 'reminder'.

Bruno Bronosky
  • 66,273
  • 12
  • 162
  • 149
  • Not sure if something like that exists, but it seems within the realm of a browser plugin or grease monkey type app... Id start there.. – Krease Jun 25 '15 at 16:50
  • You can totally do this, you can scroll to any thing that you can find the position of using [`Element.scrollTop`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop), But you should include an example of what you've tried, and what the specific programming issue is. –  Jun 25 '15 at 16:55
  • "no access to the code I am linking to" - doesn't `Element.scrollTop` require access to the js on the target page? – Toni Leigh Jun 25 '15 at 16:56
  • @ToniLeigh You can run javascript on a page opened by the current page. See: http://stackoverflow.com/questions/3772535/open-a-new-window-and-call-javascript-function –  Jun 25 '15 at 16:57
  • @TinyGiant - top answer says it isn't possible for XSS reasons, am I missing something? – Toni Leigh Jun 25 '15 at 17:00
  • @ToniLeigh Ahh, I wasn't thinking about cross-domain. This doesn't actually use cross domain javascript, but you can use PHP's curl to get the contents of the page and reshow the content on a page on your own domain, then access the copy http://stackoverflow.com/a/17262334/4639281 –  Jun 25 '15 at 17:21
  • Though this isn't a yes to the question, because you would have to use PHP, and you aren't actually referencing the real document, but just a copy of it. –  Jun 25 '15 at 17:24
  • 1
    FWIW, pretty much every question I ask on SO gets an answer of "that's impossible". If something is difficult, I figure it out. If it's hard as hell, I find an answer before asking a question. If I can't find an answer and have to ask a question, there probably isn't an answer. That's the curse of the effective engineer. – Bruno Bronosky Jun 25 '15 at 18:44
  • the only solution would be to suggest this to the browser makers ... – Toni Leigh Jun 25 '15 at 20:24

0 Answers0