Javascript - Internal or External ?

  LeadingMNMs 18:56 23 Apr 2005

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 2005

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 2005

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.

Elsewhere on IDG sites

Xiaomi Mi Mix 2 review

What went wrong at the Designs of the Year 2017

iPhone X news: Release date, price, new features & specs

Comment regarder des séries et talk-shows américains en France ?