Peter Scott
Peter Scott

Reputation: 184

IE9 and mailto character limits

Im trying to send a pre-populated email using mailto and href however I soon discovered that IE9 has a problem with recognising hrefs longer than 509 character (give or take). Basically, clicking on the link brings up a blank page. I looked for an answer and came across this javascript solution, however it still doesnt work.

Here is the anchor tag:

<a href="javascript:doMailto()">Sign up</a>

And here is the script:

var sMailto = "mailto:[email protected]?body=Dear eyecare professional,%0A%0aTo help us schedule your upcoming webinar, please fill out and return the following information:%0A%0A•  Name:%0A%0A•  Preferred date of webinar* (any Wednesday at 6 pm EST):%0A%0A•  City/State (Optional):%0A%0A•  Comments/Questions/Feedback:%0A%0AUpon receipt, we will send you a link to an upcoming GoTo Meeting webinar on Macula Risk implementation in your clinic. These webinars are regularly held on Wednesdays at 6 pm EST.%0A%0A* If you would like to request training on any other date or time - please note this in the Comments section and we will do our best to accommodate your request.%0A%0AKind Regards,%0A%0AGerry Bruckheimer";

   function doMailto() {
      document.location.href= sMailto;
   }

The weird thing is that this works in every other browser except stupid IE 9.

UPDATE: If you are experiencing a similar problem to mine, try using window.open(url). I realise its not a perfect solution but it works.

Upvotes: 1

Views: 2327

Answers (1)

Tak
Tak

Reputation: 11704

The URL limit for IE9 is actually quite high at between 5120 and 5150 when following a link. Unfortunately a Javascript hack won't help here - the limit will still be in effect. I doubt that's the issue though.

The message you're sending contains some characters that I wouldn't put in a URL, particularly "•". You should URL encode your message before putting it in a link (that last symbol encodes to %e2%80%a2 apparently). You can URL encode it in Javascript or manually encode it with an online tool before pasting it into the <a> tag.

Some browsers are more relaxed than others in handling strange characters in URL (or in code in general).

Hope that helps

Upvotes: 1

Related Questions