Why does MiniProfiler load jquery-1.7.1, even if I already loaded it on the page?

I implemented the StackExchange MiniProfiler on an ASP.NET WebForms page that already references v1.7.1 jQuery. The jQuery file is hosted locally, so my master file looks like this:

<script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script> <%= MiniProfiler.RenderIncludes() %> 

However, when I look at the source of the generated output, I get something similar to this

 <script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script> <script type="text/javascript"> ... load('/app/mini-profiler-resources/jquery.1.7.1.js?v=tNlJPuyuHLy/d5LQjyDuRbWKa0weCpmO3xkO6MH4TtA=', initMp); </script> 

Looking at the developerโ€™s network tools tab, I see that he inserts two queries, one for Scripts/jquery-1.7.1.min.js and another for /app/mini-profiler-resources/jquery.1.7.1.js

Isn't this a very serious redundancy problem? How to stop MiniProfiler from querying, loading and parsing another copy of jQuery library?

+7
source share
2 answers

The reason is that we are loading jQuery in noConflict. This eliminates the risk of jQuery version collisions. For example, we are not sure that MiniProfiler will work if jQuery version 1.0 is on the page. To avoid risk, we upload our own version.

Now I am open to a transfer request that checks the jQuery version before the request, if there is a โ€œrightโ€ version, we can just jQueryMP to jQuery alias. However, this complicates the code and solves the problem for only one version of jQuery.

+10
source

since they have a different url, these are different browser resources. Maybe you just don't need the first script you added.

or try this hack:

 <script src="/app/mini-profiler-resources/jquery.1.7.1.js?v=tNlJPuyuHLy/d5LQjyDuRbWKa0weCpmO3xkO6MH4TtA="></script> 
0
source

All Articles