By M_Ta


2019-02-09 11:29:27 8 Comments

I'm willing to use HTTP/2.0 on my apache server. I'm using apache over HTTP/1.1 and I have structured my site like this :

<head>
sharedJS.js
1.js
2.js

sharedCSS.css
1.css
2.css
</head>

Where 1,2 files have dependencies in the shared ones. In HTTP/1.1 are loaded and executed in the order of declaration. With HTTP/2.0 they are requested/loaded simultaneously but what about execution? First loaded first served? What happens if one of the 1.css/js is loaded before the relative sharedCSS/JS? Is the execution order preserved? Or I have to restructure my whole site ?

1 comments

@Rob 2019-02-09 14:43:13

No. Because the browser waits until the HTML is loaded before parsing it. Once it parses the HTML, it then reads the CSS and HTML files. Browsers never concern themselves with order of downloading.

@M_Ta 2019-02-09 18:12:16

What do you mean with "waits until the HTML is loaded"? Because for example : In my head tag I have an example.js . In my example.js I try to bind an event to an html element. It will fail, unless I wait for the DOM ready (eg : document.ready() ). So the code is executed when it is parsed/downloaded/executed. Maybe I'm messing up different things

@Rob 2019-02-09 19:41:07

@M_Ta Perhaps I confused the issue by saying it that way. What I mean is, the order of downloading by parallel in H/2 will not affect how the browser handles those files because it is the order in the HTML that matters.

Related Questions

Sponsored Content

1 Answered Questions

0 Answered Questions

1 Answered Questions

2 Answered Questions

[SOLVED] Apache reverse proxy changing Content-Type

1 Answered Questions

0 Answered Questions

Handling the HTTP Host header with what status code?

3 Answered Questions

2 Answered Questions

1 Answered Questions

1 Answered Questions

[SOLVED] Reduce HTTP Requests method for js and css

Sponsored Content