Solved

Why does my refresh take so long with the adding of links to a couple javascript libraries?

Posted on 2014-09-03
2
131 Views
Last Modified: 2014-09-03
I haven't researched this enough to know why so I was hoping someone could tell me why there was a noticeable delay (slow down) in my page refresh after I added some javascript and jQuery code (and library link references) to a page? Is it simply the time that it takes to go out through the internet (each time the page loads) to find these libraries that is causing the delay? Is there a way to improve the performance?

my javascript / jQuery

    <script type="text/javascript" src="http://cod.jquery.com/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    <script type="text/javascript">

        var delay = (function () {
            var timer = 0;
            return function (callback, ms) {
                clearTimeout(timer);
                timer = setTimeout(callback, ms);
            };
        })();

        $(document).ready(function () {
            var updateWait = setTimeout(fadeUpdate, 3000);
            function fadeUpdate() {
                $("div.UpdatedMessage").fadeOut(1000);
            }
        });
    </script>

my HTML

        <div class="updateAlert">
            <asp:Panel runat="server" ID="pnlUpdateConfirmation" Visible="false" CssClass="UpdatedMessage Alert SavedSmall">
                <h3>
                    <asp:Label runat="server" ID="lblConfirmationMsg"></asp:Label></h3>
            </asp:Panel>
        </div>

Open in new window

0
Comment
Question by:mikesExpertExchange
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40302322
you've jQuery twice lines 3 and 4, choose the more recent one until you need a specific version.
the last one compatibl with old browser is 1.11.1 : https://developers.google.com/speed/libraries/devguide?hl=fr#jquery

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

Open in new window

0
 
LVL 1

Author Closing Comment

by:mikesExpertExchange
ID: 40302333
BINGO! Thanks!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now