Open Bug 1183479 Opened 6 years ago Updated 6 years ago
link to another site's mid-page without anchor
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Build ID: 20150603135023 Expected results: Enhancement request. In my website, I'd like to link to a page on someone else's website, specifically to some arbitrary point within it, so the user won't have to scroll down by hand and I won't have to tell the user to scroll down, even though the external page author did not provide an anchor. For example, while creating my page and examining the potential link destination, I might look in the source code for a certain string representing an h3 headline. Whitespace and comments should be ignored in case of minification. If the string is not unique, the browser should auto-scroll to the first such string. If the string cannot be found, the browser should not scroll at all; that's how a browser would respond if a traditional anchor was being sought but was absent. The destination URL could use the same syngtax as for a traditional anchor: a hash mark followed by the fragment identifier; if an anchor has that fragment identifier's name, the browser would scroll to it, otherwise it would match the fragment identifier to a string in the page's source code. URLs and therefore fragment identifiers could not include angle brackets if literal, but might if encoded. Requiring the fragment identifier to be spaceless may often be impractical, so a space should be encoded for the URL. Perhaps the HTML5 "mark" element would be useful, although I'd want the mark to be invisible. HTML5 probably won't provide a mechanism for this until at least two implementations of HTML offer it, and Firefox is popular, so I hope you add it, and then that HTML5 adopts a similar system.
If you want to match based on innerHTML, this is a duplicate of bug 591830. Otherwise, it's a duplicate of either bug 978431 or bug 905766.
Severity: normal → enhancement
Component: Untriaged → Document Navigation
OS: Unspecified → All
Product: Firefox → Core
Hardware: Unspecified → All
This would give more choices than bug 905766 or 978431 would. I think I'd want to avoid innerHTML and instead choose an arbitrary string in the destination page, not just a CSS element or some such. If inline styling is absent, using element tags presents the problem of nonuniqueness. Matching any string in the destination's source code would give linkers more flexibility. I may not understand innerHTML well. I assume innerHTML cannot change content at the server, only at the user's browser. If it edits at the server, lots of Web authors would have a major security issue. If it edits a third-party website at the user's browser when someone visits my page, I'd want innerHTML to add an anchor without changing the rest of the element, but that could make a problem if the only useable element already has an identical identifying string in it; and then whatever was added would have to be removed from the display at the user's browser, so the user would be unaffected. I think I don't want to use innerHTML, but someone else might have another view.
You need to log in before you can comment on or make changes to this bug.