eHow launches Android app: Get the best of eHow on the go.

How To

How to Download a Website's JavaScript Files

Member
By seedling
User-Submitted Article
(1 Ratings)

Is there some JavaScript that you would like to view and modify from someone's website to use on your own? If so, just follow the steps in this article.

Difficulty: Moderate
Instructions

Things You'll Need:

  • A web browser and an internet connection
  1. Step 1

    Before you begin, be aware that a lot of content from various websites is copyrighted, meaning you won't be able to outright copy a site's JavaScript legally. However, you can usually take a look at it and make modifications and adaptations to use on your own site.

  2. Step 2

    First, visit the page that has the JavaScript that you would like to view and copy.

  3. Step 3

    View the web page's source code. In Firefox, you can do this by typing Ctrl+U in Firefox. (That means you hold down the control button while typing the letter "U"). In Internet Explorer, you can usually right click on the page and then click "view source".

  4. Step 4

    Sometimes the JavaScript is kept on the page itself. So look in the source code for tags saying "script". The JavaScript will be found between these tags.

  5. Step 5

    While you may find the code inside the source of the page, most of the time JavaScript files are added to the website via "includes". For example:

    type="text/javascript" src="/scripts/mycode.js"

    The above line is part of an include for a JavaScript file.

    To find this easily, you can just type "Ctrl+F" and then search for ".js". This will show you where on the page the JavaScript files, if any, are included.

  6. Step 6

    Now look at the location bar of your web browser at the top of the window. You should see something like "www.mydomain.com", or "www.someorg.org". This is the web site's domain name.

  7. Step 7

    After the domain name, copy and paste the "/scripts/mycode.js" link that you got from the "src=" above.

    For example type in "www.mydomain.com/scripts/mycode.js"

    Then hit enter. The JavaScript file should display its contents in your web browser.

  8. Step 8

    You can save the JavaScript file by selecting "File" and then "Save As" or by just highlighting all of the text and copying and pasting it into a text file.

  9. Step 9

    It's quite often the case that are 2 or 3 JavaScript files on one page and you may have to download all of them. It is possible that a function in one of the JavaScript files is calling a function in another file.

    In other words, you may need to download all of the ".js" files in order to get something that you can work with.

Tips & Warnings
  • Be sure to significantly alter any JavaScript that you get from another website.
  • Don't forget that the code that is in the page itself in script tags can interact with the code found in the .js files.
  • Don't make an exact or even close copy of someone else's JavaScript or you may be violating copyright laws.
Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Internet Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy.   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

Demand Media
eHow_eHow Technology and Electronics