One specific file slows down my response time immensely!

4 replies
Hi,

When I run a speedtest of my website this file shows up:

js_cookie.js?ver=1.0

And that file alone (even though its 0 bytes in size) takes 4-5 seconds to load.
It is located within my Optimize Press folder.

Should I delete it or just leave it? (I don't dare doing anything that will mess up my website).

Oh and by the way, when I run the test on pingdom, the file is marked in red text and has an "!" beside it (like it's a virus or something).
#file #immensely #response #slows #specific #time
  • Profile picture of the author PBScott
    Originally Posted by stolpioni View Post

    Hi,

    When I run a speedtest of my website this file shows up:

    js_cookie.js?ver=1.0

    And that file alone (even though its 0 bytes in size) takes 4-5 seconds to load.
    It is located within my Optimize Press folder.

    Should I delete it or just leave it? (I don't dare doing anything that will mess up my website).

    Oh and by the way, when I run the test on pingdom, the file is marked in red text and has an "!" beside it (like it's a virus or something).
    Looks like a javascript cookie, some kind of analytics or tracking possibly?
    ver=1.0 ? Really? No revisions? I don't know how normal that is not going to say it's an issue, but I'm just surprised.

    Some possible fixes to consider.

    1) Find out what it is before you delete it.

    2) If it is on a remote server consider hosting it yourself.

    3) Try moving it near the end of the page. <-- edited Brandon pointed out my mistake.

    4) See if you can run it in an iframe.

    5) Run it asynchronous.

    6) Run it after onload

    If you don't understand any of the above they should give you some search terms to google.

    I would normaly check all the cookies with my adblocker plugin, but I think most browsers will let you examine all the cookies on a page to see what they are.
    Signature

    If you don't look at this => Really Funny Shirts <= you missed something in life

    {{ DiscussionBoard.errors[8513532].message }}
    • Profile picture of the author Brandon Tanner
      Originally Posted by PBScott View Post

      3) Try moving it near the start of the page.
      :confused:

      If a call to a Javascript file is negatively affecting your page load speed, then it should be moved to the end of the page. In fact, it's usually a good idea to put ALL Javascript at the end of the page.

      Right before the closing </body> tag is good. For example...

      HTML Code:
      <script src="js_cookie.js?ver=1.0"></script>
      </body>
      </html>
      Signature

      {{ DiscussionBoard.errors[8514983].message }}
      • Profile picture of the author PBScott
        Originally Posted by Brandon Tanner View Post

        :confused:

        If a call to a Javascript file is negatively affecting your page load speed, then it should be moved to the end of the page. In fact, it's usually a good idea to put ALL Javascript at the end of the page.

        Right before the closing </body> tag is good. For example...

        HTML Code:
        <script src="js_cookie.js?ver=1.0"></script>
        </body>
        </html>
        @Brandon
        You are correct...Oops, I have gotten so used to working with asynchronous javascript, which is best at the start.

        You may want to put it asynchronous in the head of the document. So long as it is not super vital that it works immediately.

        Code:
        <script type="text/javascript">
        (function() 
        {     var d=document,    
         h=d.getElementsByTagName('head')[0],    
         s=d.createElement('script');     
        s.type='text/javascript';     
        s.async=true;     
        s.src='js_cookie.js?ver=1.0';     
        h.appendChild(s); }());
        </script>
        Signature

        If you don't look at this => Really Funny Shirts <= you missed something in life

        {{ DiscussionBoard.errors[8523189].message }}
  • Profile picture of the author seasoned
    If javascript deals with the site format, it should be loaded earlier. If it isn't, your site will have to be rerendered.

    Steve
    {{ DiscussionBoard.errors[8523778].message }}

Trending Topics