Category Archives: Javascript / JQuery

discussions and links to Javasript and JQuery resources

How can I use the script defer attribute for ASP MVC 4 Bundles with Scripts.Render – Stack Overflow

If you have an MVC bundle that you need to defer or async loading, you can use the following C# classes. public static class UtilityHelper { public static IHtmlString RenderAsyncScript(string virtualPath) { return Scripts.RenderFormat(@”<script src=””{0}”” async></script>”, virtualPath); } public static IHtmlString RenderDefer(string virtualPath) { return Scripts.RenderFormat(@”<script src='{0}’ defer></script>”, virtualPath); } } For example, to load […]

How to target Windows 10 Edge browser with javascript (with objectfit example usage)

Detects all versions of IE including the latest version of Windows 10 Edge. ¬†It also detects for modernizr. ¬†My example below uses Modernizr to replace the unsupported objectfit CSS property in IE. ¬†It gets replaced with a background image. <script> // Execute this if IE is detected. function msieversion() { var ua = window.navigator.userAgent; var […]