0

So I have been reading about tags and how they get loaded. It seems that unless JavaScript is dynamically injected it is loaded synchronously.

SOURCE: http://www.sitepoint.com/a-detailed-breakdown-of-the-script-tag/

That being said I was wondering whether ASP .NET "dynamically injects" JavaScript. Are there specific instances where ASP .NET would load JavaScript asynchronously?

2
  • ASP.NET is a server-side language so it can't have an effect on what the browser does. So if you write Response.Write("<script src=\"\"></script>"); in ASP.NET it will function the same as if you were just using plain old HTML. If you're worried about async, use RequireJS Commented Jul 28, 2015 at 14:46
  • it's just html... scripts are loaded synchronously, unless you explicitly have <script defer src=...> or <script async src=-...> Commented Jul 28, 2015 at 14:46

2 Answers 2

2

It seems that unless JavaScript is dynamically injected it is loaded synchronously.

That's not true. The reference you link to even talks about the defer and async attributes.

That being said I was wondering whether ASP .NET "dynamically injects" JavaScript.

ASP.NET is a server side technology. The reference you link to demonstrates dynamic injection of script elements: It is done using client side code.

So no, at least not directly. You can write ASP.NET to generate JS that dynamically injects other scripts. You can write ASP.NET to generate HTML that includes script elements directly.

Sign up to request clarification or add additional context in comments.

Comments

0

Do JavaScript files get loaded asynchronously in ASP .NET?

No, they don't.

However, you can use the async keyword like any website - it isn't part of ASP.NET.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.