Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    performace of the website when externalising code

    Could it be that when I call the different type of java code it really slows down my website? It seems to taka much much longer to load...

    let me know if there are better ways to import the code.

    The reason why I do it is because of search engine optimization. Most search engines assign a greater value to the lines of code on top, so the more javascript I have on top, the less value my main page content has.

    Please share your thoughts.

    Thanks

  • #2
    Regular Coder
    Join Date
    Feb 2003
    Posts
    638
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't know about the importing, but the code can be placed at the bottom of the document...
    hmm... ?

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    maybe that works... I will ask some SEO Guru :)

    thanks anyways...

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    As far as I know search engines do not search inside the javascript or CSS code, so you don't have to worry about that.

    the code can be placed at the bottom
    Yes, but is a better ideea to put the code in head, as the head is loaded first, and you may need some of those codelines to set up something in body onload.

    Anyway, you may use external JS files to reduce the size of the head, if you want it so...
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    Regular Coder
    Join Date
    Feb 2003
    Posts
    638
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Kor
    put the code in head, as the head is loaded first, and you may need some of those codelines to set up something in body onload.
    Is that really a factor?

    I haven't observed any differences between this:
    <head>
    <title> - </title>
    <script type="text/JavaScript">
    // code...
    </script>
    </head>


    and this:
    <body>
    <p>content...</p>
    <p>content...</p>
    <p>content...</p>
    <p>content...</p>
    <script type="text/JavaScript">
    // code...
    </script>
    </body>


    How would the onload event be adversely effected by lower code placement?
    Last edited by swmr; 03-12-2004 at 06:04 PM.
    hmm... ?

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    do smthlike

    <body onload="afunction()">
    and that function called somewhere

    <script code here>
    </body>

    an , on a slow connection you will know what I mean.

    The loading system is a sequential one. If good speed, no notable difference (well, no lazy-eyed... ) if medium/slow speed... hm
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #7
    Regular Coder
    Join Date
    Feb 2003
    Posts
    638
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ah, I hadn't tried that...

    wouldn't calling document.body.onload = function afunction(){//code} as the last task before </script> correct for slow loading?
    hmm... ?

  • #8
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    wouldn't calling document.body.onload = function afunction(){//code} ...
    ...in fact
    window.onload = afunction;
    or
    window.onload = function(){afunction(parameter_if_needed)}

    Yes, this will correct the problem, if this line is the last code's line.

    But, I repeat, at least as long as the script is inner quoted by "nonhtml" commentaries as
    <script>
    <!--
    ..code lines here
    -->
    </script>

    The search engines will jump over the code, as they search only in HTML code lines, in fact only text in HTML code.

    Furthermore, if the script (javascript or CSS) is clearly maked up in tag as a special type, the search engines will jump the script as well.

    <script language="JavaScript" type="text/JavaScript">
    <style type="text/css">
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •