{"id":1012,"date":"2010-10-17T19:57:32","date_gmt":"2010-10-17T19:57:32","guid":{"rendered":"http:\/\/www.phpmind.com\/blog\/?p=1012"},"modified":"2010-10-17T19:58:57","modified_gmt":"2010-10-17T19:58:57","slug":"how-to-include-multiple-js-file-in-one-js-file","status":"publish","type":"post","link":"https:\/\/www.phpmind.com\/blog\/2010\/10\/how-to-include-multiple-js-file-in-one-js-file\/","title":{"rendered":"How to include multiple js file in one js file?"},"content":{"rendered":"<p>To include multiple js files in page is bad in terms of http request. Yslow Yahoo! tool can give you bad grade. Grade F on making more HTTP requests.<br \/>\nApart from that page loading time increases and page does not looks clean.<\/p>\n<p>Combined files are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining all CSS into a single stylesheet.<\/p>\n<p> Including multiple .js file in one external file has several advantages.<br \/>\n1. Less HTTP request.<br \/>\n2. If cashing is on page lode faster.<br \/>\n3. Page looks clean.<\/p>\n<p>Use this code to add as much as files as you want. <\/p>\n<pre lang=\"javascript\">\r\n\r\ndocument.write('<script type=\"text\/javascript\" src=\"file1.js\"><\/script>');\r\ndocument.write('<script type=\"text\/javascript\" src=\"file2.js\"><\/script>');\r\ndocument.write('<script type=\"text\/javascript\" src=\"file3.js\"><\/script>');\r\ndocument.write('<script type=\"text\/javascript\" src=\"file4.js\"><\/script>'); \r\n    \r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To include multiple js files in page is bad in terms of http request. Yslow Yahoo! tool can give you bad grade. Grade F on making more HTTP requests. Apart from that page loading time increases and page does not looks clean. Combined files are a way to reduce the number of HTTP requests by [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[27],"tags":[],"class_list":["post-1012","post","type-post","status-publish","format-standard","hentry","category-javascript"],"_links":{"self":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/comments?post=1012"}],"version-history":[{"count":4,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1012\/revisions"}],"predecessor-version":[{"id":1016,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1012\/revisions\/1016"}],"wp:attachment":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/media?parent=1012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/categories?post=1012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/tags?post=1012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}