• Resolved kertoon

    (@kertoon)


    I am trying to combine javascript together as one external file to defer loading. I am not sure am I doing the correct thing. I got the javascript upload into my root directory in a .js file.

    Then I paste the the code below below before the </body> tag.

    <script defer="defer" type="text/javascript">
        window.onload=function(){
            var mycode;
            mycode=document.createElement("script");
            mycode.type="text/javascript";
            mycode.src="https://www.my site name.com/my external javascript file end with .js";
            document.getElementsByTagName("head")[0].appendChild(mycode);
        }
    </script>
Viewing 6 replies - 1 through 6 (of 6 total)
  • Are you getting any errors?

    Thread Starter kertoon

    (@kertoon)

    I am not too sure. As for the external file link is working. It is just that according to the page speed tool Pingdom Tool , the Combine external JavaScript has no effect.

    Because according to pingdom, the page is finished loading. I doubt it executes all of your post-loading javascript as well. Go to your page and check the page source. Is the JavaScript there? Is it doing what it’s supposed to be doing?

    Thread Starter kertoon

    (@kertoon)

    The list of pages with Javascript are all there. That is where I got the whole bunch of javascript. I pasted them on the Notepad, minified them before I had it uploaded to my root directory.

    Anyway, a while ago, when I went back to Pingdom Tools I notice I managed to score 1/100 for Combine external Javascript. And now there newly created external file is included in the list!

    I don’t understand. So the problem persists or you have solved it?

    Thread Starter kertoon

    (@kertoon)

    John Bryan, thank you so much for your prompt reply. It is solved.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘External Javascript File Not Working’ is closed to new replies.