P.S. I tried making a file like below: src='http://platform.twitter.com/widgets.js' src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" src="http://platform.linkedin.com/in.js" src="https://apis.google.com/js/plusone.js"
and then saved it as social.js, but it didn't executed as needed.
The main motive to do this is to minimize the HTTP requests and fasten the loading time of the site.
Thanks much for your reply, really appreciate it. But what if I extract the content of all the files and then want to call them as one JS file? As imo these files' content don't change often. Can I and how? Thanks again in anticipation
1. Save each of the four files locally (just point your browser at [platform.twitter.com...] and save it locally, then do the same with the other 3 files).
2. Create a new empty file.
3. Open the first file in a text editor (notepad, etc.), select all (ctrl + A), copy to your clipboard (ctrl + C), switch to the new file and paste it in (ctrl + V).
4. Repeat for each of the other 3 files. You may want to insert a newline between each, or add some comment before each to indicate where the file came from, or there may be license information associated with each file that needs to remain with the file.
No problem core. Foti, these are third party scripts, core has no way of knowing when they will be changed by their respective hosts hence the solution I suggested. I had thought about what you suggested though decided against it. Either way I'm wary of third party software.
Ah, that's a valid argument (assuming you want to pick up changes from those third party scripts vs. having a static code base). In addition, it's possible for those links to pull in other resources, which might fail if the script is served locally.
A problem I just thought of...if one server is not responsive it will likely delay the collective file from being served as a whole. Again I'll reiterate it's undesirable to work with third party code for all sorts of reasons, there are always compromises. Foti's solution would remove that issue but again if the third parties change their code something on your site might break. Third party code simply amounts to which path of compromise you think will harm you the least in the long term.