我试图使用mailto和href发送预填充电子邮件,但是我很快发现IE9在识别超过509个字符(给定或占用)的hrefs时遇到问题。基本上,点击链接会出现一个空白页面。我寻找答案,并遇到这个JavaScript解决方案,但它仍然无法正常工作。IE9和mailto字符限制
这里是锚标记:
<a href="javascript:doMailto()">Sign up</a>
这里是脚本:
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;
}
奇怪的是,这部作品在其他浏览器,除了IE笨9
更新:如果您遇到类似的问题,请尝试使用window.open(url)。我意识到它不是一个完美的解决方案,但它的作品
我有同样的问题。似乎是sMailTo长度的问题。如果长度大于508个字符,则失败。 – BlackMael
可能与Bookmarklet长度限制508也有关 – BlackMael