0

I'm unfamiliar with angular. However, I'm trying to open a mail dialog with a body like this :

$window.location.href = "mailto:?subject=HEY fun?&body=" + body;

This works for small bodies due to the URL constraint if I'm correct ? Is there a way around this ?

user1511956
  • 784
  • 3
  • 9
  • 22

1 Answers1

0

It is correct. Web browsers pose a de facto limit of 2000 characters (see here).

You could use a hidden iframe... See this example hack...:

$window.location.href = mailtoHref("mailto:?subject=HEY fun?&body=" + body);

function mailtoHack(href) {
    var iframeHack;
    if (href.indexOf("mailto:") === 0) {
        iframeHack = document.createElement("IFRAME");
        iframeHack.src = href;
        document.body.appendChild(iframeHack);
        document.body.removeChild(iframeHack);
    }
}

Disclaimer: untested code...

Community
  • 1
  • 1
MarcoS
  • 17,323
  • 24
  • 96
  • 174