SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Mad Beach Bum jgsketch's Avatar
    Join Date
    Aug 2002
    Location
    FL
    Posts
    825
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Extra Javascript in website

    I just purchased a website and have found alot of javascript in it. Unfortunatly I do not know java that well and cannot tell if I need some of this stuff. I fear that google is reading too much java and not enough content on my page.

    There is one section of encrypted text that the owner says is code for detecting bandwidth and then displaying either a flash video or picture.

    my questions are
    1. can I move these all into seperate javascript.js files (I assume Google will not read JS files).
    2. Can I delete any of this code without it harming my site.

    I'm not a complete idiot, so I did notice what some of the scripts are. I see a cookie script, popup script, and about 3 different speed connection scripts.

    Because of the large quantity of code, I have uploaded a txt file to this post, of the top of my page after the head tag and before the body tag.
    Attached Files Attached Files

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,044
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)

    "extra" javascript

    I don't know if any of the code is "extra" as far as not needing it, but it doesn't need to be hard-coded into the head section.
    For example, you could take
    HTML Code:
    <script language="JavaScript">
      function JSgetExpireDate()
    .....
      function JSsetCookie(name, value, expire )
    .....
      function readCookie(name)
    .....
    </script>
    Put in an external file named cookies.js (without the script tags) ie.
    Code:
      function JSgetExpireDate()
    .....
      function JSsetCookie(name, value, expire )
    .....
      function readCookie(name)
    .....
    and reference like
    HTML Code:
    <script type="text/javascript" src="path/cookies.js"></script>
    As for as Google seeing the code, I don't think they see it whether it's in the page or external either way.

  3. #3
    Mad Beach Bum jgsketch's Avatar
    Join Date
    Aug 2002
    Location
    FL
    Posts
    825
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you. I put all the javascript in external JS files. The code looks cleaner now. Thanks.


Bookmarks

Posting Permissions

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