pmaj
pmaj

Reputation: 51

Do JavaScript files get loaded asynchronously in ASP .NET?

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?

Upvotes: 0

Views: 335

Answers (2)

Joe Ratzer
Joe Ratzer

Reputation: 18569

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.

Upvotes: 0

Quentin
Quentin

Reputation: 944010

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.

Upvotes: 2

Related Questions