Hi all. This is a very old question, but as I recalled, the reason for not being able to use the HTML tag attributes, was because I was bundling and minifying my .js files in production environment only, and therefore could'nt use the 'async' attribute while developmenting on my local maching. Then my .js script simply broke while being loaded asynchronically.
As I recall I created this little helper method to cope with my problem:
public static object CdfAsync()
{
if (!HttpContext.Current.IsDebuggingEnabled)
{
return new { async = "async" };
}
return null;
}
Clientdependency: Add 'async' attribute on 'script'tag
Im' struggling with Clientdependency on my site - I think it has very great potential.
It is essential for me to have an 'async' attribute on the script tag for the bundled and minified javascript. (Only when not running in Debug mode).
I tried using both regex and Replace() methods on this @Html.RenderJsHere() with no luck.
I cannot use Html tag attributes as described in the Documantation.
If I don't solve this I'm affraid I'll have to abandon using Clientdependency and find an alternative... :(
Hi Robin,
Did you find any solution on this?
Thank you
Hi Robin,
You mention that you cannot use HTML tag attributes — do you mean that it doesn't work, or that you don't have access to the code that writes it?
/Chriztian
Hi all. This is a very old question, but as I recalled, the reason for not being able to use the HTML tag attributes, was because I was bundling and minifying my .js files in production environment only, and therefore could'nt use the 'async' attribute while developmenting on my local maching. Then my .js script simply broke while being loaded asynchronically.
As I recall I created this little helper method to cope with my problem:
I hope this answer will be helpfull... :-)
is working on a reply...