URI encoding in Yahoo mail compose link

前端 未结 4 1817
南旧
南旧 2020-12-19 16:23

I have link generating web app. I\'d like to make it easy for users to email the links they create to others using gmail, yahoo mail, etc. Yahoo mail has a particular quirk

相关标签:
4条回答
  • 2020-12-19 16:38

    I think you're at the mercy of what Yahoo's server does when it issues the HTTP redirect. It seems like it should preserve the URL escaping on the redirect, but isn't. However, without knowledge of their underlying application, it's hard to say why it wouldn't. Perhaps, it's just an unintended side effect (or bug), or perhaps some of the Javascript features on that page require them to do some finagling with the hash tag.

    0 讨论(0)
  • 2020-12-19 16:40

    For the newline, add the newline as < BR > and double encode it also, it is interpreted successfully as new line in the new message

    0 讨论(0)
  • 2020-12-19 16:43

    Here is how i do it:

    1. run a window.escape on those chars: & ' " # > < \

    2. run a encodeURIComponent on the full string

    it works for most of my case. though newline (\n) is still an issue, but I replace \n with space in my case and it worked fine.

    0 讨论(0)
  • 2020-12-19 16:50

    I have been dealing with the same problem the last couple of hours and I found a workaround!

    If you double-encode the anchor it will be interpreted correctly by Yahoo. That means change %23 to %2523 (the percent-sign is %25 encoded).

    So your URI will be:
    http://compose.mail.yahoo.com/?body=http%3A%2F%2Flocalhost%3A8000%2Fpath%2523anchor

    The same workaround can be used for ampersand. If you only encode that as %26, then Yahoo will convert that to "&amp;" which will discard the rest of message. Same procedure as above - change %26 to %2526.

    I still haven't found a solution to the newline-problem though (%0D and %0A).

    0 讨论(0)
提交回复
热议问题