Question

I'm developing an Ember.js application on my own and while started to track how the scripts do loading, just noticed that if the ember.js core and the handlebars.js are minified in the same file, my application.js will load twice.

Why?

Here

Is it a strange behaviour of the ember.js and it loads only 'virtually twice' or loads twice for real?

AngularJS was the same but there I got the answer on this behaviour that it's just 'virtual' that means the js wont load again but before angular could initialize it has to tell the browser that 'I have been loaded' and it only could to this in that way.

So is this the same way?

Thanks in advance for answers, Have a good day!

Was it helpful?

Solution

This has nothing to do with Ember.js (or Angular, for that matter). This is just the way HTTP works. Your browser is attempting to load a resource that it has already loaded with a If-Modified-Since header or some other header that makes the GET request "conditional". (See http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html)

If you notice in your network display, the HTTP response (status) is 304, which means "Not modified"- so there is no transfer of content. However, the request/response cycle does cost some time, so you should probably look to see why you are requesting the same resource twice...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top