Javascript - Internal or External ?

  LeadingMNMs 18:56 23 Apr 05
Locked

Although I'm sure the download speeds will be negligible, I was wondering whether it would be best to have the Javascript within the HTML file or externally.

The site is written in PHP and the Javascript can be included, so there won't be any problems updating the code, should it be required.

Don't suppose its really that important, but how would you advise it to be done ? I suppose the same goes for the CSS - it can also be included in the PHP and so the browser would only have to download the one HTML file, rather than three seperate file.

  mattyc_92 19:56 23 Apr 05

I suppose that it is better using external java files, but only for security reasons e.g. you have created a login "members only" area on your site using Java (then you can store the usernames and passwords more securely)

  smudge101 10:48 24 Apr 05

I don't think ther would be any noticable difference in speed so from that point of view it doesn't matter which way you choose.

Personally I would tend to use external files as it will make your site easier to maintain. Take for example CSS, if all your pages are using the same CSS formatting then you would only have to make changes to one file to update the whole site.

Also code within code can be alot more difficult to read.

This thread is now locked and can not be replied to.

New Google phones UK release date | Pixel XL price, new features, specifications: Pixel X and…

1995-2015: How technology has changed the world in 20 years

This is the future of TV, VR and holograms

iOS 10 troubleshooting tips: Simple fixes for the most common iOS 10 problems, from network…