<a href="http://example.com">http://example.com</a>if (string begins with http://) && (string is not enclosed in " make it a link; } --- Presumably there is already code to fix dropped quotations or closing tags, run this afterwards.posted by 256 at 9:39 PM on April 20, 2012
href could cause this.href=""blah blahbut there's also cases where folks manage by one means or another to paste/type in the url but forget the protocol, like
blah blahand that will link back to the thread (or Recent Activity, or wherever you're viewing that comment or post from) because without the initial "http://" on the url the browser interprets the href content as a relative rather than absolute link: it assumes that "www.example.com/whatever/blah.html" is actually an item in the current subdirectory or an id on the current page, which of course fails to reference any actual page content.
http:// so you can paste over it, iOS devices don't. So on the iPhone at least you can tap and hold in the link dialog, choose Select All, and then paste. We also check for the string "http://http://" and turn it into one "http://" via the link dialog only. So if you happen to put "http://http://www.example.com/" into the new link dialog you will end up with "http://www.example.com/" in the textarea.
I've posted more then one link in the past that didn't end up being hyperlink-a-tized because I'm just so use to the rest of the internet automatically converting them into links for me. After I hit the post button and then I see it's just a lowly, unclickable bit of text.. and remember Metafilter doesn't to automatic links.
Just please don't do what some forums do..
http://www.I-rather-see-the-full-url.com/likeThis/andNotShorthandLikeTheLineBelowThisOne.htm
http://www.i-rahter-see-the-full-url.com/...thisOne.htm
posted by royalsong at 8:28 PM on April 20, 2012