0

How to load all css and js on one request

Here is a sample HTML document that similarly includes many CSS and JavaScript files

< link rel="stylesheet" type="text/css" href="path/to/960framework.css">

< link rel="stylesheet" type="text/css" href="path/to/base.css">

< link rel="stylesheet" type="text/css" href="path/to/navigations.css">

< script type="text/javascript" src="path/to/jQuery.js">

< script type="text/javascript" src="path/to/functions.js">

< script type="text/javascript" src="path/to/handlers.js">

... more then

its make 6 request but i want load all js and css at a time (only one request )

so i try

for css

allStyles.css.php //

include("cssReset.css");

include("960framework.css");

include("base.css");

for js

allScripts.js.php

include("jQuery.js");

include("functions.js");

include("handlers.js");

include("ajax.js");

include("navigations.css");

and just call

< link rel="stylesheet" type="text/css" href="path/to/allStyles.css.php">

< script type="text/javascript" src="path/to/allScripts.js.php">

all js and css loaded but css and js not woring n page?

1 Answer 1

1

php is not sending the appropriate content type header in the response. for you add these line s to the top of the page

<?php header("Content-type: text/css"); ?> <?php header("Content-type: application/javascript"); ?> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.