Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

[#100] prepend with http:// if missing in link #101

Merged
merged 1 commit into from
Sep 4, 2012

Conversation

cordoval
Copy link
Contributor

@cordoval cordoval commented Sep 1, 2012

ref #100

@@ -40,6 +40,9 @@
window.getSelection().addRange(widget.lastSelection);
document.execCommand "unlink", null, ""
else
// link does not have http://, add it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to have a comment here ( @bergie - I don't see a lot of comments - so not sure if you have a general standard not to include them or only include them when really needed) - then it would be a bit more accurate to read if the link does not have "://" in it, prepend with http://

bergie added a commit that referenced this pull request Sep 4, 2012
[#100] prepend with http:// if missing in link
@bergie bergie merged commit 5f6cbf9 into bergie:master Sep 4, 2012
@freezy
Copy link

freezy commented Apr 15, 2013

So what if I wanted to add a relative link? Right now I'm getting http://../somepage which is obviously not expected behavior.

@mozmorris
Copy link

@freezy I'm having the same issue with relatives and absolutes.

"/contact-us" becomes "http:///contact-us"
"../contact-us" becomes "http://../contact-us"

I think it should check for a forward slash or dot in the first character. If present, skip prepending the "http://".

@mozmorris
Copy link

In fact, this change broke these types of links as well: href="tel:07777" and href="skype:themoz"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants