Results 1 to 2 of 2

Thread: How do I serve external JS from my site?

  1. #1
    Kovich's Avatar
    Kovich is offline Community Guardian
    Join Date
    Jan 2009
    Location
    Philadelphia, Pennsylvania
    Posts
    1,797
    Blog Entries
    30
    Thanks
    453
    Thanked 420 Times in 279 Posts

    How do I serve external JS from my site?

    As many of you know, I am a stickler for speed and efficiency. So I'm trying to minimize DNS lookups and external resources on my make money online blog. I've already taken care of everything... except external javascript, because I have no idea how to serve this from my own site!

    hxxp://static.addtoany.com/menu/page.js
    hxxp://www.google-analytics.com/ga.js

    Those are the two pieces of javascript I have on my site that I need to try and serve from my own, if possible. If it's not possible, it's not a big deal. So, does anybody know how I would go about doing this? Any advice is greatly appreciated.

    Also, is it better to serve images from say:
    runningonlinebusiness.com/images or from
    images.runningonlinebusiness.com

  2. #2
    Keldorn's Avatar
    Keldorn is offline Net Builder
    Join Date
    Dec 2008
    Location
    Canada
    Posts
    400
    Thanks
    21
    Thanked 60 Times in 52 Posts
    I think you might be missing the "why" website serve images from subdomains, this only benefits you if you set cookies to be placed on Example Web Page . (damn auto links seo titles..) www. example .com and not example.com ,else the cookies will be sent also to the subdomain. Becuase thats what your tyring to prevent, becuase on a large scale those cookies even if only a few bytes, can scale up to a lot of network traffic and wasted bandwidth.

    Here is a Quote from Yahoo Developer.
    Yahoo Best Practices for Speeding Up Your Web Site

    Use Cookie-free Domains for Components
    When the browser makes a request for a static image and sends cookies together with the request, the server doesn't have any use for those cookies. So they only create network traffic for no good reason. You should make sure static components are requested with cookie-free requests. Create a subdomain and host all your static components there.

    If your domain is www.example.org, you can host your static components on static.example.org. However, if you've already set cookies on the top-level domain example.org as opposed to www.example.org, then all the requests to static.example.org will include those cookies. In this case, you can buy a whole new domain, host your static components there, and keep this domain cookie-free. Yahoo! uses yimg.com, YouTube uses ytimg.com, Amazon uses images-amazon.com and so on.


    Another benefit of hosting static components on a cookie-free domain is that some proxies might refuse to cache the components that are requested with cookies. On a related note, if you wonder if you should use example.org or www.example.org for your home page, consider the cookie impact. Omitting www leaves you no choice but to write cookies to *.example.org, so for performance reasons it's best to use the www subdomain and write the cookies to that subdomain.
    So if you serve your images from images.runningonlinebusiness.com but people are still sending the cookie with the requests, then there is no benefit, it actually might be worse,like you mention about DSN Lookups, becuase then it requires another DNS lookup for your subdomain while still sending cookies.
    Unless you have so much traffic you actually need a subdomain with an A record pointing to a static content server.

    As far as the Google javascript goes, you probably cannot cache that and serve it off your website. It just doesn't seem like a good idea.
    Its also already proliferated threw-out the internet anyways, and is likely already cached in the browser of any visitor you get, so its not a big deal.
    Last edited by Keldorn; 16 December, 2009 at 02:14 AM.
    Submit new proxies -

Similar Threads

  1. PayPal Competitor- American Express 'Serve'.
    By rome9t9 in forum Business
    Replies: 11
    Last Post: 25 July, 2012, 03:36 AM
  2. Should U.S. Politicians Be Required to Serve in the Military?
    By javanx3d in forum Politics and Religion
    Replies: 19
    Last Post: 30 January, 2011, 19:22 PM
  3. Replies: 0
    Last Post: 29 September, 2010, 08:34 AM
  4. [WTS] [External Auction]
    By Bravo in forum Domains
    Replies: 0
    Last Post: 8 September, 2010, 19:04 PM
  5. [WTS] [External Auction] LLL.net domain name....
    By Bravo in forum Domains
    Replies: 1
    Last Post: 25 February, 2010, 09:17 AM

Tags for this Thread

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
  •