What are the performance hit or implications, if any, of:
-
If I have multiple
<script>tags on one .aspx page? -
Declaring variables in
<script>tags of a .aspx page and calling these
variables from an external .js file?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Multiple
<script>tags containing in-line javascript will not affect performance. Multiple<script>tags that load external javascript files will of course result in multiple requests; in this case it’s better for performance to combine the external files into a single file.Declaring variables within the page and referencing them outside is fine, although of course you need the declarations to be before the tags that load the external file. This is a common pattern for situations where you’re getting the value for a javascript variable from server-side code.