質問

I'm trying to specify a mailto link in an HTML template, for a Google Apps script. Unfortunately, the link:

<a href="mailto:foo@bar.com">

is converted to

<a href="mailto:foo%40bar.com">

because of the processing involved.

How would I return the correct mailto link?

More simply when I do return HTML via a call:

function doGet(request) {
   return HtmlService.createHtmlOutput('<a href="foo@bar.com">mail me</a>');
}

the returned HTML is:

<a target="_parent" href="mailto:foo%40bar.com">mail me</a>

which is OK for some mail applications (Mac Mail) but is not the standard.

正しい解決策はありません

他のヒント

This is not the ideal answer that I was hoping for but it is a solution to the problem. As is turns out if you have Caja processor evaluate your HTML in Native mode, it won't do this '@' -> '%40' translation.

return template.evaluate().setSandboxMode(HtmlService.SandboxMode.NATIVE);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top