HtmlTextWriter を使用してスクリプト タグをページに動的に追加していますが、これはうまく機能します。async キーワードを追加する必要があるものがいくつかありますが、その方法がわかりません。
タグはこんな感じにしたいです。
<script id="my_script" async type="text/javascript" src="myscript.js"></script>
タグを作成する私の方法は次のようになります。
internal static void RenderJavaScriptInclude(HtmlTextWriter writer, string filePath, string Id)
{
writer.AddAttribute(HtmlTextWriterAttribute.Id, Id);
writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
writer.AddAttribute(HtmlTextWriterAttribute.Src, filePath);
writer.RenderBeginTag(HtmlTextWriterTag.Script);
writer.RenderEndTag();
}
「非同期」を追加するように変更するにはどうすればよいですか?
いつもありがとうございます。
ロンダ