Say I wanted to credit someone's answer in my own answer. I'd normally write something like this:

Using what [Dlamblin][1] [said][2], I think the code would look like this:

  [1]: https://meta.stackoverflow.com/users/459/dlamblin
  [2]: #1129732

Notice that the said is linked, and if you use Control+L and paste in "#1129732" the 2 will be generated with http://#1129732. I use a relative link because there's no need to reload the same exact page, so it's nicer for people.

So WMD is throwing in an extra http:// in front of these kinds of relative links. Normally this is helpful for say "google.com/bookmarks" but not in this case;
Shouldn't a leading "#" stop that behavior?


My answer shows that despite the code in the WMD not supporting relative links, there remains a mildly inconvenient route to producing the links. Therefore they probably aren't an XSS threat. This explains why I feel WMD's behavior is imperfect.

Because I do understand that questions are sometimes on another page, Kyle's suggestion of having some kind of link that is either relative if the question is currently on the page, or fully qualified if it is not, would be wonderful. Understandably it'd be some extra work. It's possibly best done as front end JS code which scans for a tags in the form of href="#XYZ" and fixes them to href=document.domain+"/XYZ#XYZ if the corresponding a tag with name="XYZ" isn't found on this page.

  • Weapons of Mass Destruction? :) – Benjol Oct 7 '10 at 5:46
  • @Benjol Jeff knows what I mean. WMD: The Wysiwym Markdown Editor – dlamblin Nov 9 '10 at 1:36

as per https://stackoverflow.com/editing-help , which is linked from the [?] toolbar button above the editor, as well as the sidebar on every editing page

All URLs must be fully qualified path names. We do not support relative paths.


This policy has changed. We now allow links that begin with http:// or https:// or ftp:// , or links that begin with / -- in other words, links relative to the parent URL are allowed.

(We also no longer allow #\d+ numeric answer URLs any more -- they're not particularly useful.)

You must log in to answer this question.

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