Produce a “type” attribute in the “script” tag when using Scripts.Render in ASP.NET MVC 4

余生颓废 提交于 2019-12-10 14:09:13

问题


Is it possible to configure Scripts.Render in ASP.NET MVC 4 to produce a "type" attribute in the "script" tag?

If so, how?

Thanks in advance,

Ryan


回答1:


The 1.1-alpha1 update has support doing your own tag formatting with the Scripts/Styles helpers.

There's a new DefaultTagFormat property which is by default set to:

"<script src="{0}"></script>"

There's also a RenderFormat method which takes in the tag format as well. You should be able to add the type attribute via either of these two mechanicsms.



来源:https://stackoverflow.com/questions/13051301/produce-a-type-attribute-in-the-script-tag-when-using-scripts-render-in-asp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!